From 68518f549719d4c150acc920197587425f2de341 Mon Sep 17 00:00:00 2001 From: Xavier Priour Date: Wed, 14 Oct 2015 10:54:42 +0200 Subject: Import single card: map labels --- models/boards.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'models/boards.js') 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 || -- cgit v1.2.3-1-g7c22