diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-01-25 19:05:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-25 19:05:44 +0200 |
commit | 5d6203f5f99d02fc508015c0889977da55eff2f1 (patch) | |
tree | 3663d29721ea91df9546bef35cd3896d0fecb1cb /models/lists.js | |
parent | 4a2576fbc200d397bcf7cede45316d9fb7e520dd (diff) | |
parent | 97d95b4bcbcab86629e368ea41bb9f00450b21f6 (diff) | |
download | wekan-5d6203f5f99d02fc508015c0889977da55eff2f1.tar.gz wekan-5d6203f5f99d02fc508015c0889977da55eff2f1.tar.bz2 wekan-5d6203f5f99d02fc508015c0889977da55eff2f1.zip |
Merge pull request #2128 from bentiss/color-lists
Color lists
Diffstat (limited to 'models/lists.js')
-rw-r--r-- | models/lists.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/models/lists.js b/models/lists.js index 0e1ba801..54e7d037 100644 --- a/models/lists.js +++ b/models/lists.js @@ -92,6 +92,21 @@ Lists.attachSchema(new SimpleSchema({ type: Boolean, defaultValue: false, }, + color: { + /** + * the color of the list + */ + 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', + ], + }, })); Lists.allow({ @@ -148,6 +163,12 @@ Lists.helpers({ return list.wipLimit[option] ? list.wipLimit[option] : 0; // Necessary check to avoid exceptions for the case where the doc doesn't have the wipLimit field yet set } }, + + colorClass() { + if (this.color) + return this.color; + return ''; + }, }); Lists.mutations({ @@ -174,6 +195,17 @@ Lists.mutations({ setWipLimit(limit) { return { $set: { 'wipLimit.value': limit } }; }, + + setColor(newColor) { + if (newColor === 'silver') { + newColor = null; + } + return { + $set: { + color: newColor, + }, + }; + }, }); Meteor.methods({ @@ -314,9 +346,11 @@ if (Meteor.isServer) { try { Authentication.checkUserId( req.userId); const paramBoardId = req.params.boardId; + const board = Boards.findOne(paramBoardId); const id = Lists.insert({ title: req.body.title, boardId: paramBoardId, + sort: board.lists().count(), }); JsonRoutes.sendResult(res, { code: 200, |