mirror of
https://github.com/wekan/wekan.git
synced 2025-12-23 19:00:12 +01:00
Labels drag/drop
This commit is contained in:
parent
cb9b8d4f2b
commit
c8b8fb83dc
4 changed files with 72 additions and 10 deletions
|
|
@ -901,6 +901,20 @@ Boards.helpers({
|
|||
return _id;
|
||||
},
|
||||
|
||||
/** sets the new label order
|
||||
* @param newLabelOrderOnlyIds new order array of _id, e.g. Array(4) [ "FvtD34", "PAEgDP", "LjRBxH", "YJ8sZz" ]
|
||||
*/
|
||||
setNewLabelOrder(newLabelOrderOnlyIds) {
|
||||
if (this.labels.length == newLabelOrderOnlyIds.length) {
|
||||
if (this.labels.every(_label => newLabelOrderOnlyIds.indexOf(_label._id) >= 0)) {
|
||||
const newLabels = _.sortBy(this.labels, _label => newLabelOrderOnlyIds.indexOf(_label._id));
|
||||
if (this.labels.length == newLabels.length) {
|
||||
Boards.direct.update(this._id, {$set: {labels: newLabels}});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
searchBoards(term) {
|
||||
check(term, Match.OneOf(String, null, undefined));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue