2015-10-30 12:21:59 +01:00
|
|
|
Session.setDefault('ViewerData', {});
|
|
|
|
|
|
2016-02-28 21:25:23 +01: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 18:58:05 +01: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-03-10 04:47:17 +01:00
|
|
|
'optionsModal',
|
2016-03-24 14:28:51 +01:00
|
|
|
'serverInformationModal',
|
2016-04-05 18:16:50 +02:00
|
|
|
'confirmRemoveTimepointAssociation',
|
2016-08-26 18:04:34 +02:00
|
|
|
'lastLoginModal',
|
|
|
|
|
'viewSeriesDetailsModal'
|
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 14:35:06 +01:00
|
|
|
// Check user is logged in
|
2016-06-07 19:09:47 +02:00
|
|
|
if (Meteor.user() && Meteor.userId()) {
|
2016-03-22 20:43:06 +01:00
|
|
|
if (verifyEmail && Meteor.user().emails && !Meteor.user().emails[0].verified) {
|
2016-02-28 18:58:05 +01:00
|
|
|
this.render('emailVerification', routerOptions);
|
|
|
|
|
} else {
|
2016-08-15 15:34:36 +02:00
|
|
|
Session.set('activeContentId', 'studylistTab');
|
|
|
|
|
this.render('app', routerOptions);
|
2016-02-28 18:58:05 +01:00
|
|
|
}
|
|
|
|
|
|
2016-02-15 14:36:01 +01:00
|
|
|
} else {
|
2016-02-28 18:58:05 +01:00
|
|
|
this.render('entrySignIn', routerOptions);
|
2016-01-27 14:35:06 +01: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
|
|
|
|
2016-08-15 15:34:36 +02:00
|
|
|
this.render('app', routerOptions);
|
2016-10-17 22:17:31 +02:00
|
|
|
OHIF.lesiontracker.openNewTabWithTimepoint(timepointId);
|
2015-10-30 12:21:59 +01:00
|
|
|
}
|
2016-01-11 11:32:20 +01:00
|
|
|
});
|
2016-03-28 04:40:43 +02:00
|
|
|
|
2016-06-07 19:09:47 +02:00
|
|
|
Router.onBeforeAction(function() {
|
|
|
|
|
if (!Meteor.userId() && !Meteor.loggingIn()) {
|
2016-03-28 04:40:43 +02:00
|
|
|
this.render('entrySignIn');
|
|
|
|
|
} else {
|
|
|
|
|
this.next();
|
|
|
|
|
}
|
2016-06-07 19:09:47 +02:00
|
|
|
}, {
|
|
|
|
|
except: ['entrySignIn', 'entrySignUp', 'forgotPassword', 'resetPassword']
|
|
|
|
|
});
|