mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 18:00:12 +01:00
enable add/remove labels for multiselect via shortcut
This commit is contained in:
parent
0e9aa2eeed
commit
4d31985eb9
4 changed files with 54 additions and 8 deletions
|
|
@ -8,7 +8,7 @@ function getHoveredCardId() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectedCardId() {
|
function getSelectedCardId() {
|
||||||
return Session.get('currentCard') || getHoveredCardId();
|
return Session.get('currentCard') || Session.get('selectedCard') || getHoveredCardId();
|
||||||
}
|
}
|
||||||
|
|
||||||
Mousetrap.bind('?', () => {
|
Mousetrap.bind('?', () => {
|
||||||
|
|
@ -68,21 +68,58 @@ Mousetrap.bind(['down', 'up'], (evt, key) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
numArray = _.range(1,10).map(x => String(x))
|
numbArray = _.range(1,10).map(x => 'shift+'+String(x))
|
||||||
Mousetrap.bind(numArray, (evt, key) => {
|
Mousetrap.bind(numbArray, (evt, key) => {
|
||||||
num = parseInt(key);
|
num = parseInt(key.substr(6, key.length));
|
||||||
const cardId = getSelectedCardId();
|
const currentUserId = Meteor.userId();
|
||||||
if (!cardId) {
|
if (currentUserId === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const currentBoardId = Session.get('currentBoard');
|
const currentBoardId = Session.get('currentBoard');
|
||||||
board = Boards.findOne(currentBoardId);
|
board = Boards.findOne(currentBoardId);
|
||||||
labels = board.labels;
|
labels = board.labels;
|
||||||
|
if(MultiSelection.isActive())
|
||||||
|
{
|
||||||
|
const cardIds = MultiSelection.getSelectedCardIds();
|
||||||
|
for (const cardId of cardIds)
|
||||||
|
{
|
||||||
|
card = Cards.findOne(cardId);
|
||||||
|
if(num <= board.labels.length)
|
||||||
|
{
|
||||||
|
card.removeLabel(labels[num-1]["_id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
numArray = _.range(1,10).map(x => String(x))
|
||||||
|
Mousetrap.bind(numArray, (evt, key) => {
|
||||||
|
num = parseInt(key);
|
||||||
const currentUserId = Meteor.userId();
|
const currentUserId = Meteor.userId();
|
||||||
|
const currentBoardId = Session.get('currentBoard');
|
||||||
if (currentUserId === null) {
|
if (currentUserId === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
board = Boards.findOne(currentBoardId);
|
||||||
|
labels = board.labels;
|
||||||
|
if(MultiSelection.isActive() && Meteor.user().isBoardMember())
|
||||||
|
{
|
||||||
|
const cardIds = MultiSelection.getSelectedCardIds();
|
||||||
|
for (const cardId of cardIds)
|
||||||
|
{
|
||||||
|
card = Cards.findOne(cardId);
|
||||||
|
if(num <= board.labels.length)
|
||||||
|
{
|
||||||
|
card.addLabel(labels[num-1]["_id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cardId = getSelectedCardId();
|
||||||
|
if (!cardId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Meteor.user().isBoardMember()) {
|
if (Meteor.user().isBoardMember()) {
|
||||||
const card = Cards.findOne(cardId);
|
const card = Cards.findOne(cardId);
|
||||||
if(num <= board.labels.length)
|
if(num <= board.labels.length)
|
||||||
|
|
@ -182,5 +219,9 @@ Template.keyboardShortcuts.helpers({
|
||||||
keys: ['number keys 1-9'],
|
keys: ['number keys 1-9'],
|
||||||
action: 'toggle-labels'
|
action: 'toggle-labels'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
keys: ['shift + number keys 1-9'],
|
||||||
|
action: 'remove-labels-multiselect'
|
||||||
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,9 @@ MultiSelection = {
|
||||||
isEmpty() {
|
isEmpty() {
|
||||||
return this.count() === 0;
|
return this.count() === 0;
|
||||||
},
|
},
|
||||||
|
getSelectedCardIds(){
|
||||||
|
return this._selectedCards.curValue;
|
||||||
|
},
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
if (!this.isActive()) {
|
if (!this.isActive()) {
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,8 @@
|
||||||
"has-spenttime-cards": "Hat Karten mit aufgewendeten Zeiten",
|
"has-spenttime-cards": "Hat Karten mit aufgewendeten Zeiten",
|
||||||
"time": "Zeit",
|
"time": "Zeit",
|
||||||
"title": "Titel",
|
"title": "Titel",
|
||||||
"toggle-labels": "Label 1-9 für Karte Toggeln",
|
"toggle-labels": "Label 1-9 für Karte Toggeln. \"Multiselect\": Label 1-9 hinzufügen",
|
||||||
|
"remove-labels-multiselect": "\"Multiselect\" Label 1-9 entfernen",
|
||||||
"tracking": "Folgen",
|
"tracking": "Folgen",
|
||||||
"tracking-info": "Sie werden über alle Änderungen an Karten benachrichtigt, an denen Sie als Ersteller oder Mitglied beteiligt sind.",
|
"tracking-info": "Sie werden über alle Änderungen an Karten benachrichtigt, an denen Sie als Ersteller oder Mitglied beteiligt sind.",
|
||||||
"type": "Typ",
|
"type": "Typ",
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,8 @@
|
||||||
"has-spenttime-cards": "Has spent time cards",
|
"has-spenttime-cards": "Has spent time cards",
|
||||||
"time": "Time",
|
"time": "Time",
|
||||||
"title": "Title",
|
"title": "Title",
|
||||||
"toggle-labels": "Toggle Labels 1-9 for card",
|
"toggle-labels": "Toggle labels 1-9 for card. \"Multiselect\": adds labels 1-9",
|
||||||
|
"remove-labels-multiselect": "\"Multiselect\" removes labels 1-9",
|
||||||
"tracking": "Tracking",
|
"tracking": "Tracking",
|
||||||
"tracking-info": "You will be notified of any changes to those cards you are involved as creator or member.",
|
"tracking-info": "You will be notified of any changes to those cards you are involved as creator or member.",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue