diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-08-27 00:27:23 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-08-28 00:39:18 +0200 |
commit | 31c4aa01bda63e510e120ae9da8149c732111d2a (patch) | |
tree | 9d567a379c75f9f7feb9c687108ce53841a5399c /client/lib/keyboard.js | |
parent | 95dcd8a146d5fa8ef0957019faf59fbfdcf98788 (diff) | |
download | wekan-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/lib/keyboard.js')
-rw-r--r-- | client/lib/keyboard.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js index bd78390a..066836d4 100644 --- a/client/lib/keyboard.js +++ b/client/lib/keyboard.js @@ -1,35 +1,37 @@ -// XXX Pressing `?` should display a list of all shortcuts available. -// // XXX There is no reason to define these shortcuts globally, they should be // attached to a template (most of them will go in the `board` template). -Mousetrap.bind('w', function() { +Mousetrap.bind('?', () => { + FlowRouter.go('shortcuts'); +}); + +Mousetrap.bind('w', () => { Sidebar.toogle(); }); -Mousetrap.bind('q', function() { - var currentBoardId = Session.get('currentBoard'); - var currentUserId = Meteor.userId(); +Mousetrap.bind('q', () => { + const currentBoardId = Session.get('currentBoard'); + const currentUserId = Meteor.userId(); if (currentBoardId && currentUserId) { Filter.members.toogle(currentUserId); } }); -Mousetrap.bind('x', function() { +Mousetrap.bind('x', () => { if (Filter.isActive()) { Filter.reset(); } }); -Mousetrap.bind(['down', 'up'], function(evt, key) { +Mousetrap.bind(['down', 'up'], (evt, key) => { if (! Session.get('currentCard')) { return; } - var nextFunc = (key === 'down' ? 'next' : 'prev'); - var nextCard = $('.js-minicard.is-selected')[nextFunc]('.js-minicard').get(0); + const nextFunc = (key === 'down' ? 'next' : 'prev'); + const nextCard = $('.js-minicard.is-selected')[nextFunc]('.js-minicard').get(0); if (nextCard) { - var nextCardId = Blaze.getData(nextCard)._id; + const nextCardId = Blaze.getData(nextCard)._id; Utils.goCardId(nextCardId); } }); |