diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-01-25 19:05:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-25 19:05:09 +0200 |
commit | ba15526516e1754385d2d6404d64ae9cead3ce95 (patch) | |
tree | 29834be1c70610ea3373e03c64891a6b35569fd1 /models/swimlanes.js | |
parent | 542cc75dc4a4bf392cac72345ab013cf59c67ad3 (diff) | |
parent | 6c3dbc3c6f52a42ddbeeaec9bbfcc82c1c839f7d (diff) | |
download | wekan-ba15526516e1754385d2d6404d64ae9cead3ce95.tar.gz wekan-ba15526516e1754385d2d6404d64ae9cead3ce95.tar.bz2 wekan-ba15526516e1754385d2d6404d64ae9cead3ce95.zip |
Merge pull request #2126 from bentiss/color-swimlanes
Color for swimlanes
Diffstat (limited to 'models/swimlanes.js')
-rw-r--r-- | models/swimlanes.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/models/swimlanes.js b/models/swimlanes.js index fa5245da..e2c3925c 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 }; @@ -224,9 +256,11 @@ if (Meteor.isServer) { try { Authentication.checkUserId( req.userId); const paramBoardId = req.params.boardId; + const board = Boards.findOne(paramBoardId); const id = Swimlanes.insert({ title: req.body.title, boardId: paramBoardId, + sort: board.swimlanes().count(), }); JsonRoutes.sendResult(res, { code: 200, |