summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-01-09 23:22:27 +0200
committerLauri Ojansivu <x@xet7.org>2020-01-09 23:22:27 +0200
commitd16a601c04aeb1d3550c5c541be02a67276a34cf (patch)
tree0a09d8f31168793d4da16d03302550b6ccca9a2a /client/lib
parent5724674e73246f4e52843a6d6906c0ecdd85cccc (diff)
downloadwekan-d16a601c04aeb1d3550c5c541be02a67276a34cf.tar.gz
wekan-d16a601c04aeb1d3550c5c541be02a67276a34cf.tar.bz2
wekan-d16a601c04aeb1d3550c5c541be02a67276a34cf.zip
More keyboard shortcuts: c for archive card
Thanks to xet7 ! Related #1878
Diffstat (limited to 'client/lib')
-rwxr-xr-xclient/lib/keyboard.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js
index d3f974be..da33f806 100755
--- a/client/lib/keyboard.js
+++ b/client/lib/keyboard.js
@@ -70,6 +70,30 @@ Mousetrap.bind('space', evt => {
}
});
+// XXX This shortcut should also work when hovering over a card in board view
+Mousetrap.bind('c', evt => {
+ if (!Session.get('currentCard')) {
+ return;
+ }
+
+ const currentUserId = Meteor.userId();
+ if (currentUserId === null) {
+ return;
+ }
+
+ if (
+ Meteor.user().isBoardMember() &&
+ !Meteor.user().isCommentOnly() &&
+ !Meteor.user().isWorker()
+ ) {
+ const card = Cards.findOne(Session.get('currentCard'));
+ card.archive();
+ // 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: [
{
@@ -104,5 +128,9 @@ Template.keyboardShortcuts.helpers({
keys: ['SPACE'],
action: 'shortcut-assign-self',
},
+ {
+ keys: ['C'],
+ action: 'archive-card',
+ },
],
});