Files
ohif-viewer/LesionTracker/client/routes.js
T

70 lines
1.8 KiB
JavaScript
Raw Normal View History

Session.setDefault('ViewerData', {});
// 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
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'layout'
});
Router.onBeforeAction('loading');
var data = {
additionalTemplates: [
'associationModal',
'optionsModal',
'serverInformationModal',
'confirmRemoveTimepointAssociation',
'lastLoginModal'
]
};
var routerOptions = {
data: data
};
Router.route('/', function() {
// 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
}
} else {
2016-02-28 12:58:05 -05:00
this.render('entrySignIn', routerOptions);
}
});
Router.route('/viewer/timepoints/:_id', {
layoutTemplate: 'layout',
name: 'viewer',
onBeforeAction: function() {
var timepointId = this.params._id;
// 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
var tab = WorklistTabs.findOne({
timepointId: timepointId
});
if (tab) {
return;
}
2016-06-07 19:09:47 +02:00
this.render('lesionTracker', routerOptions);
openNewTabWithTimepoint(timepointId);
}
});
2016-06-07 19:09:47 +02:00
Router.onBeforeAction(function() {
if (!Meteor.userId() && !Meteor.loggingIn()) {
this.render('entrySignIn');
} else {
this.next();
}
2016-06-07 19:09:47 +02:00
}, {
except: ['entrySignIn', 'entrySignUp', 'forgotPassword', 'resetPassword']
});