diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-05-29 23:35:30 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-05-30 03:50:14 +0200 |
commit | 2c0030da62b9a1e59a55e3429fe514bbd51e1ee3 (patch) | |
tree | b2834702806e59cb05ea02e2c377266eb17d6c8f /client/config | |
parent | 6457615e6ac6717d2175be9483388d4d70ea1c4a (diff) | |
download | wekan-2c0030da62b9a1e59a55e3429fe514bbd51e1ee3.tar.gz wekan-2c0030da62b9a1e59a55e3429fe514bbd51e1ee3.tar.bz2 wekan-2c0030da62b9a1e59a55e3429fe514bbd51e1ee3.zip |
Implement multi-selection
The UI and the internal APIs are still rough around the edges but the
feature is basically working. You can now select multiple cards and
move them together or (un|)assign them a label.
Diffstat (limited to 'client/config')
-rw-r--r-- | client/config/router.js | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/client/config/router.js b/client/config/router.js index d4bc3c4f..ed9a069d 100644 --- a/client/config/router.js +++ b/client/config/router.js @@ -1,3 +1,6 @@ +// XXX Switch to Flow-Router? +var previousRoute; + Router.configure({ loadingTemplate: 'spinner', notFoundTemplate: 'notfound', @@ -6,24 +9,43 @@ Router.configure({ onBeforeAction: function() { var options = this.route.options; + var loggedIn = Tracker.nonreactive(function() { + return !! Meteor.userId(); + }); + // Redirect logged in users to Boards view when they try to open Login or // signup views. - if (Meteor.userId() && options.redirectLoggedInUsers) { + if (loggedIn && options.redirectLoggedInUsers) { return this.redirect('Boards'); } // Authenticated - if (! Meteor.userId() && options.authenticated) { + if (! loggedIn && options.authenticated) { return this.redirect('atSignIn'); } - // Reset default sessions - Session.set('error', false); - Tracker.nonreactive(function() { - EscapeActions.executeLowerThan(40); + if (! options.noEscapeActions && + ! (previousRoute && previousRoute.options.noEscapeActions)) + EscapeActions.executeAll(); }); + previousRoute = this.route; + this.next(); } }); + +// We want to execute our EscapeActions.executeLowerThan method any time the +// route is changed, but not if the stays the same but only the parameters +// change (eg when a user is navigation from a card A to a card B). This is why +// we can’t put this function in the above `onBeforeAction` that is being run +// too many times, instead we register a dependency only on the route name and +// use Tracker.autorun. The following paragraph explains the problem quite well: +// https://github.com/meteorhacks/flow-router#routercurrent-is-evil +// Tracker.autorun(function(computation) { +// routeName.get(); +// if (! computation.firstRun) { +// EscapeActions.executeLowerThan('inlinedForm'); +// } +// }); |