summaryrefslogtreecommitdiffstats
path: root/client/config
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-08-27 00:27:23 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-08-28 00:39:18 +0200
commit31c4aa01bda63e510e120ae9da8149c732111d2a (patch)
tree9d567a379c75f9f7feb9c687108ce53841a5399c /client/config
parent95dcd8a146d5fa8ef0957019faf59fbfdcf98788 (diff)
downloadwekan-31c4aa01bda63e510e120ae9da8149c732111d2a.tar.gz
wekan-31c4aa01bda63e510e120ae9da8149c732111d2a.tar.bz2
wekan-31c4aa01bda63e510e120ae9da8149c732111d2a.zip
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: https://github.com/rackt/react-router/tree/cf0419f70e14a0ae39cba2ff99b01d3cbbd085be/examples/pinterest
Diffstat (limited to 'client/config')
-rw-r--r--client/config/router.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/client/config/router.js b/client/config/router.js
index ef874c5b..eb072934 100644
--- a/client/config/router.js
+++ b/client/config/router.js
@@ -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' });