mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04: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() {
|
||||
return Session.get('currentCard') || getHoveredCardId();
|
||||
return Session.get('currentCard') || Session.get('selectedCard') || getHoveredCardId();
|
||||
}
|
||||
|
||||
Mousetrap.bind('?', () => {
|
||||
|
@ -68,21 +68,58 @@ Mousetrap.bind(['down', 'up'], (evt, key) => {
|
|||
}
|
||||
});
|
||||
|
||||
numArray = _.range(1,10).map(x => String(x))
|
||||
Mousetrap.bind(numArray, (evt, key) => {
|
||||
num = parseInt(key);
|
||||
const cardId = getSelectedCardId();
|
||||
if (!cardId) {
|
||||
numbArray = _.range(1,10).map(x => 'shift+'+String(x))
|
||||
Mousetrap.bind(numbArray, (evt, key) => {
|
||||
num = parseInt(key.substr(6, key.length));
|
||||
const currentUserId = Meteor.userId();
|
||||
if (currentUserId === null) {
|
||||
return;
|
||||
}
|
||||
const currentBoardId = Session.get('currentBoard');
|
||||
board = Boards.findOne(currentBoardId);
|
||||
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 currentBoardId = Session.get('currentBoard');
|
||||
if (currentUserId === null) {
|
||||
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()) {
|
||||
const card = Cards.findOne(cardId);
|
||||
if(num <= board.labels.length)
|
||||
|
@ -182,5 +219,9 @@ Template.keyboardShortcuts.helpers({
|
|||
keys: ['number keys 1-9'],
|
||||
action: 'toggle-labels'
|
||||
},
|
||||
{
|
||||
keys: ['shift + number keys 1-9'],
|
||||
action: 'remove-labels-multiselect'
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
@ -83,6 +83,9 @@ MultiSelection = {
|
|||
isEmpty() {
|
||||
return this.count() === 0;
|
||||
},
|
||||
getSelectedCardIds(){
|
||||
return this._selectedCards.curValue;
|
||||
},
|
||||
|
||||
activate() {
|
||||
if (!this.isActive()) {
|
||||
|
|
|
@ -571,7 +571,8 @@
|
|||
"has-spenttime-cards": "Hat Karten mit aufgewendeten Zeiten",
|
||||
"time": "Zeit",
|
||||
"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-info": "Sie werden über alle Änderungen an Karten benachrichtigt, an denen Sie als Ersteller oder Mitglied beteiligt sind.",
|
||||
"type": "Typ",
|
||||
|
|
|
@ -571,7 +571,8 @@
|
|||
"has-spenttime-cards": "Has spent time cards",
|
||||
"time": "Time",
|
||||
"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-info": "You will be notified of any changes to those cards you are involved as creator or member.",
|
||||
"type": "Type",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue