2015-10-30 12:21:59 +01:00
|
|
|
Session.setDefault('ViewerData', {});
|
|
|
|
|
|
2016-02-28 15:25:23 -05:00
|
|
|
// verifyEmail controls whether emailVerification template will be rendered or not
|
|
|
|
|
var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false;
|
2016-02-28 12:58:05 -05:00
|
|
|
|
2015-10-30 12:21:59 +01:00
|
|
|
Router.configure({
|
2016-07-23 20:11:01 +02:00
|
|
|
layoutTemplate: 'layout',
|
|
|
|
|
loadingTemplate: 'layout'
|
2015-10-30 12:21:59 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Router.onBeforeAction('loading');
|
|
|
|
|
|
2016-01-12 21:56:07 +01:00
|
|
|
var data = {
|
|
|
|
|
additionalTemplates: [
|
2016-01-13 16:17:32 +01:00
|
|
|
'associationModal',
|
2016-03-09 22:47:17 -05:00
|
|
|
'optionsModal',
|
2016-03-24 09:28:51 -04:00
|
|
|
'serverInformationModal',
|
2016-04-05 12:16:50 -04:00
|
|
|
'confirmRemoveTimepointAssociation',
|
|
|
|
|
'lastLoginModal'
|
2016-01-12 21:56:07 +01:00
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var routerOptions = {
|
|
|
|
|
data: data
|
|
|
|
|
};
|
|
|
|
|
|
2016-01-11 11:32:20 +01:00
|
|
|
Router.route('/', function() {
|
2016-01-27 08:35:06 -05:00
|
|
|
// Check user is logged in
|
2016-06-07 19:09:47 +02:00
|
|
|
if (Meteor.user() && Meteor.userId()) {
|
2016-03-22 15:43:06 -04:00
|
|
|
if (verifyEmail && Meteor.user().emails && !Meteor.user().emails[0].verified) {
|
2016-02-28 12:58:05 -05:00
|
|
|
this.render('emailVerification', routerOptions);
|
|
|
|
|
} else {
|
2016-06-08 17:33:43 +02:00
|
|
|
Session.set('activeContentId', 'worklistTab');
|
2016-06-07 19:09:47 +02:00
|
|
|
this.render('lesionTracker', routerOptions);
|
2016-02-28 12:58:05 -05:00
|
|
|
}
|
|
|
|
|
|
2016-02-15 14:36:01 +01:00
|
|
|
} else {
|
2016-02-28 12:58:05 -05:00
|
|
|
this.render('entrySignIn', routerOptions);
|
2016-01-27 08:35:06 -05:00
|
|
|
}
|
2016-01-25 17:14:42 +01:00
|
|
|
});
|
|
|
|
|
|
2016-01-13 16:17:32 +01:00
|
|
|
Router.route('/viewer/timepoints/:_id', {
|
2016-07-23 20:11:01 +02:00
|
|
|
layoutTemplate: 'layout',
|
2015-10-30 12:21:59 +01:00
|
|
|
name: 'viewer',
|
|
|
|
|
onBeforeAction: function() {
|
2016-01-13 16:17:32 +01:00
|
|
|
var timepointId = this.params._id;
|
2015-10-30 12:21:59 +01:00
|
|
|
|
|
|
|
|
// Check if this study is already loaded in a tab
|
|
|
|
|
// If it is, stop here so we don't keep adding tabs on hot-code reloads
|
2016-01-13 16:17:32 +01:00
|
|
|
var tab = WorklistTabs.findOne({
|
|
|
|
|
timepointId: timepointId
|
|
|
|
|
});
|
2015-10-30 12:21:59 +01:00
|
|
|
if (tab) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-07 19:09:47 +02:00
|
|
|
this.render('lesionTracker', routerOptions);
|
2016-01-13 16:17:32 +01:00
|
|
|
openNewTabWithTimepoint(timepointId);
|
2015-10-30 12:21:59 +01:00
|
|
|
}
|
2016-01-11 11:32:20 +01:00
|
|
|
});
|
2016-03-27 22:40:43 -04:00
|
|
|
|
2016-06-07 19:09:47 +02:00
|
|
|
Router.onBeforeAction(function() {
|
|
|
|
|
if (!Meteor.userId() && !Meteor.loggingIn()) {
|
2016-03-27 22:40:43 -04:00
|
|
|
this.render('entrySignIn');
|
|
|
|
|
} else {
|
|
|
|
|
this.next();
|
|
|
|
|
}
|
2016-06-07 19:09:47 +02:00
|
|
|
}, {
|
|
|
|
|
except: ['entrySignIn', 'entrySignUp', 'forgotPassword', 'resetPassword']
|
|
|
|
|
});
|