wekan/client/config/router.js
Maxime Quandalle 40c2411f2a Implement a new system to handle "escape actions"
The new EscapeActions object decide what to do when the user press the
Escape key (such as closing a opened popup or inlined form).

This commit also re-introduced the sidebar current view as a sidebar
component local state.
2015-05-26 20:34:56 +02:00

29 lines
690 B
JavaScript

Router.configure({
loadingTemplate: 'spinner',
notFoundTemplate: 'notfound',
layoutTemplate: 'defaultLayout',
onBeforeAction: function() {
var options = this.route.options;
// Redirect logged in users to Boards view when they try to open Login or
// signup views.
if (Meteor.userId() && options.redirectLoggedInUsers) {
return this.redirect('Boards');
}
// Authenticated
if (! Meteor.userId() && options.authenticated) {
return this.redirect('atSignIn');
}
// Reset default sessions
Session.set('error', false);
Tracker.nonreactive(function() {
EscapeActions.executeLowerThan(40);
});
this.next();
}
});