diff options
author | Xavier Priour <xavier.priour@bubblyware.com> | 2015-10-14 10:54:42 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-10-14 23:23:16 +0200 |
commit | 68518f549719d4c150acc920197587425f2de341 (patch) | |
tree | 2134098d3449e1b0397af060a8997b6f07f100fb /models | |
parent | 432c1ebb5d9165b9c63b10ef489c6f9e84470e72 (diff) | |
download | wekan-68518f549719d4c150acc920197587425f2de341.tar.gz wekan-68518f549719d4c150acc920197587425f2de341.tar.bz2 wekan-68518f549719d4c150acc920197587425f2de341.zip |
Import single card: map labels
Diffstat (limited to 'models')
-rw-r--r-- | models/boards.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/models/boards.js b/models/boards.js index 4baec280..8d2b63e4 100644 --- a/models/boards.js +++ b/models/boards.js @@ -92,6 +92,12 @@ Boards.helpers({ return _.where(this.members, {isActive: true}); }, + getLabel(name, color) { + return this.labels.find((current) => { + return ((current.name === name) && (current.color === color)); + }); + }, + labelIndex(labelId) { return _.indexOf(_.pluck(this.labels, '_id'), labelId); }, @@ -293,8 +299,8 @@ if (Meteor.isServer) { }); }); - // If the user remove one label from a board, we cant to remove reference of - // this label in any card of this board. + // If the user removes a label from a board, we have to remove references to + // this label in all cards of the board. Boards.after.update((userId, doc, fieldNames, modifier) => { if (!_.contains(fieldNames, 'labels') || !modifier.$pull || |