From 03efeaeb1abae0c8c39ad5644d44bad36f415d99 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Thu, 24 Jan 2019 16:47:09 +0100 Subject: Add colors to swimlanes fixes #1688 --- models/swimlanes.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'models/swimlanes.js') diff --git a/models/swimlanes.js b/models/swimlanes.js index fa5245da..93057362 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -49,6 +49,21 @@ Swimlanes.attachSchema(new SimpleSchema({ // XXX We should probably provide a default optional: true, }, + color: { + /** + * the color of the swimlane + */ + type: String, + optional: true, + // silver is the default, so it is left out + allowedValues: [ + 'white', 'green', 'yellow', 'orange', 'red', 'purple', + 'blue', 'sky', 'lime', 'pink', 'black', + 'peachpuff', 'crimson', 'plum', 'darkgreen', + 'slateblue', 'magenta', 'gold', 'navy', 'gray', + 'saddlebrown', 'paleturquoise', 'mistyrose', 'indigo', + ], + }, updatedAt: { /** * when was the swimlane last edited @@ -93,6 +108,12 @@ Swimlanes.helpers({ board() { return Boards.findOne(this.boardId); }, + + colorClass() { + if (this.color) + return this.color; + return ''; + }, }); Swimlanes.mutations({ @@ -107,6 +128,17 @@ Swimlanes.mutations({ restore() { return { $set: { archived: false } }; }, + + setColor(newColor) { + if (newColor === 'silver') { + newColor = null; + } + return { + $set: { + color: newColor, + }, + }; + }, }); Swimlanes.hookOptions.after.update = { fetchPrevious: false }; -- cgit v1.2.3-1-g7c22