diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-09-19 15:51:46 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-09-19 15:51:46 +0200 |
commit | 9d5f473395e75d1c45940be43b06312085be4010 (patch) | |
tree | 61584c870baeddc02968313e61722cdca4bdbc0d | |
parent | cd9a1094ea15ddba93f5d48f4ed3b6d2124cc4eb (diff) | |
parent | 14b7213af4f9409bdf4211f2731d5a1ca2c99ce3 (diff) | |
download | wekan-9d5f473395e75d1c45940be43b06312085be4010.tar.gz wekan-9d5f473395e75d1c45940be43b06312085be4010.tar.bz2 wekan-9d5f473395e75d1c45940be43b06312085be4010.zip |
Merge pull request #314 from fisle/devel
Shortcut: Spacebar assigns self to current card, 'F' toggles filter sidebar
-rw-r--r-- | client/lib/keyboard.js | 34 | ||||
-rw-r--r-- | i18n/en.i18n.json | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js index af5fb7a2..f8212c9b 100644 --- a/client/lib/keyboard.js +++ b/client/lib/keyboard.js @@ -23,6 +23,14 @@ Mousetrap.bind('x', () => { } }); +Mousetrap.bind('f', () => { + if (Sidebar.isOpen() && Sidebar.getView() === 'filter') { + Sidebar.toggle(); + } else { + Sidebar.setView('filter'); + } +}); + Mousetrap.bind(['down', 'up'], (evt, key) => { if (!Session.get('currentCard')) { return; @@ -36,6 +44,26 @@ Mousetrap.bind(['down', 'up'], (evt, key) => { } }); +// XXX This shortcut should also work when hovering over a card in board view +Mousetrap.bind('space', (evt) => { + if (!Session.get('currentCard')) { + return; + } + + const currentUserId = Meteor.userId(); + if (currentUserId === null) { + return; + } + + if (Meteor.user().isBoardMember()) { + const card = Cards.findOne(Session.get('currentCard')); + card.toggleMember(currentUserId); + // We should prevent scrolling in card when spacebar is clicked + // This should do it according to Mousetrap docs, but it doesn't + evt.preventDefault(); + } +}); + Template.keyboardShortcuts.helpers({ mapping: [{ keys: ['W'], @@ -44,6 +72,9 @@ Template.keyboardShortcuts.helpers({ keys: ['Q'], action: 'shortcut-filter-my-cards', }, { + keys: ['F'], + action: 'shortcut-toggle-filterbar', + }, { keys: ['X'], action: 'shortcut-clear-filters', }, { @@ -58,5 +89,8 @@ Template.keyboardShortcuts.helpers({ }, { keys: [':'], action: 'shortcut-autocomplete-emojies', + }, { + keys: ['SPACE'], + action: 'shortcut-assign-self', }], }); diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 85a0dcc5..a8c2c5d9 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -177,12 +177,14 @@ "save": "Save", "search": "Search", "select-color": "Select a color", + "shortcut-assign-self": "Assign yourself to current card", "shortcut-autocomplete-emojies": "Autocomplete emojies", "shortcut-autocomplete-members": "Autocomplete members", "shortcut-clear-filters": "Clear all filters", "shortcut-close-dialog": "Close Dialog", "shortcut-filter-my-cards": "Filter my cards", "shortcut-show-shortcuts": "Bring up this shortcuts list", + "shortcut-toggle-filterbar": "Toggle Filter Sidebar", "shortcut-toggle-sidebar": "Toggle Board Sidebar", "signupPopup-title": "Create an Account", "star-board-title": "Click to star this board. It will show up at top of your boards list.", |