mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
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.
63 lines
1.6 KiB
JavaScript
63 lines
1.6 KiB
JavaScript
Meteor.subscribe('boards');
|
|
|
|
var boardSubsManager = new SubsManager();
|
|
|
|
Router.route('/boards', {
|
|
name: 'Boards',
|
|
template: 'boards',
|
|
authenticated: true,
|
|
onBeforeAction: function() {
|
|
Session.set('currentBoard', '');
|
|
Filter.reset();
|
|
this.next();
|
|
}
|
|
});
|
|
|
|
Router.route('/boards/:_id/:slug', {
|
|
name: 'Board',
|
|
template: 'board',
|
|
onAfterAction: function() {
|
|
// XXX We probably shouldn't rely on Session
|
|
Session.set('sidebarIsOpen', true);
|
|
Session.set('currentWidget', 'home');
|
|
Session.set('menuWidgetIsOpen', false);
|
|
},
|
|
waitOn: function() {
|
|
var params = this.params;
|
|
Session.set('currentBoard', params._id);
|
|
Session.set('currentCard', null);
|
|
|
|
return boardSubsManager.subscribe('board', params._id, params.slug);
|
|
},
|
|
data: function() {
|
|
return Boards.findOne(this.params._id);
|
|
}
|
|
});
|
|
|
|
Router.route('/boards/:boardId/:slug/:cardId', {
|
|
name: 'Card',
|
|
template: 'board',
|
|
onAfterAction: function() {
|
|
Tracker.nonreactive(function() {
|
|
if (! Session.get('currentCard') && Sidebar) {
|
|
Sidebar.hide();
|
|
}
|
|
});
|
|
var params = this.params;
|
|
Session.set('currentBoard', params.boardId);
|
|
Session.set('currentCard', params.cardId);
|
|
},
|
|
waitOn: function() {
|
|
var params = this.params;
|
|
return boardSubsManager.subscribe('board', params.boardId, params.slug);
|
|
},
|
|
data: function() {
|
|
return Boards.findOne(this.params.boardId);
|
|
}
|
|
});
|
|
|
|
// Close the card details pane by pressing escape
|
|
EscapeActions.register(50,
|
|
function() { return ! Session.equals('currentCard', null); },
|
|
function() { Utils.goBoardId(Session.get('currentBoard')); }
|
|
);
|