summaryrefslogtreecommitdiffstats
path: root/models/swimlanes.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-01-25 19:05:44 +0200
committerGitHub <noreply@github.com>2019-01-25 19:05:44 +0200
commit5d6203f5f99d02fc508015c0889977da55eff2f1 (patch)
tree3663d29721ea91df9546bef35cd3896d0fecb1cb /models/swimlanes.js
parent4a2576fbc200d397bcf7cede45316d9fb7e520dd (diff)
parent97d95b4bcbcab86629e368ea41bb9f00450b21f6 (diff)
downloadwekan-5d6203f5f99d02fc508015c0889977da55eff2f1.tar.gz
wekan-5d6203f5f99d02fc508015c0889977da55eff2f1.tar.bz2
wekan-5d6203f5f99d02fc508015c0889977da55eff2f1.zip
Merge pull request #2128 from bentiss/color-lists
Color lists
Diffstat (limited to 'models/swimlanes.js')
-rw-r--r--models/swimlanes.js34
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,