mirror of
https://github.com/wekan/wekan.git
synced 2025-12-23 19:00:12 +01:00
Open a modal (or a new page) based on context
This feature is also sometime named the Pinterest-style route, which is further explained in this react-router example:
cf0419f70e/examples/pinterest
This commit is contained in:
parent
95dcd8a146
commit
31c4aa01bd
6 changed files with 57 additions and 24 deletions
|
|
@ -1,3 +1,8 @@
|
|||
let previousPath;
|
||||
FlowRouter.triggers.exit([({path}) => {
|
||||
previousPath = path;
|
||||
}]);
|
||||
|
||||
FlowRouter.route('/', {
|
||||
name: 'home',
|
||||
triggersEnter: [AccountsTemplates.ensureSignedIn],
|
||||
|
|
@ -5,7 +10,8 @@ FlowRouter.route('/', {
|
|||
EscapeActions.executeAll();
|
||||
Filter.reset();
|
||||
|
||||
Session.set('currentBoard', '');
|
||||
Session.set('currentBoard', null);
|
||||
Session.set('currentCard', null);
|
||||
|
||||
BlazeLayout.render('defaultLayout', { content: 'boardList' });
|
||||
}
|
||||
|
|
@ -31,14 +37,32 @@ FlowRouter.route('/b/:id/:slug', {
|
|||
FlowRouter.route('/b/:boardId/:slug/:cardId', {
|
||||
name: 'card',
|
||||
action: function(params) {
|
||||
EscapeActions.executeUpTo('popup-close');
|
||||
Session.set('currentBoard', params.boardId);
|
||||
Session.set('currentCard', params.cardId);
|
||||
EscapeActions.executeUpTo('popup-close');
|
||||
|
||||
BlazeLayout.render('defaultLayout', { content: 'board' });
|
||||
}
|
||||
});
|
||||
|
||||
FlowRouter.route('/shortcuts', {
|
||||
name: 'shortcuts',
|
||||
action: function(params) {
|
||||
const shortcutsTemplate = 'keyboardShortcuts';
|
||||
|
||||
EscapeActions.executeUpTo('popup-close');
|
||||
|
||||
if (previousPath) {
|
||||
Modal.open(shortcutsTemplate, {
|
||||
onCloseGoTo: previousPath
|
||||
});
|
||||
} else {
|
||||
// XXX There is currently no way to escape this page on Sandstorm
|
||||
BlazeLayout.render('defaultLayout', { content: shortcutsTemplate });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
FlowRouter.notFound = {
|
||||
action: function() {
|
||||
BlazeLayout.render('defaultLayout', { content: 'notFound' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue