summaryrefslogtreecommitdiffstats
path: root/models/cards.js
diff options
context:
space:
mode:
authorPouyan Savoli <papoola@hotmail.com>2017-08-30 03:23:57 +0200
committerPouyan Savoli <papoola@hotmail.com>2017-09-22 22:59:32 +0200
commit733b14dcd8f4b94047ffd444e7ab7ded49c245c0 (patch)
treea7213494e45b0d960544cf405443db9a429f68c6 /models/cards.js
parentd87191f17ee1cd49def9ca5a4d3d1568b041e6a2 (diff)
downloadwekan-733b14dcd8f4b94047ffd444e7ab7ded49c245c0.tar.gz
wekan-733b14dcd8f4b94047ffd444e7ab7ded49c245c0.tar.bz2
wekan-733b14dcd8f4b94047ffd444e7ab7ded49c245c0.zip
card model and card ui preparation for custom fields #2
Diffstat (limited to 'models/cards.js')
-rw-r--r--models/cards.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/models/cards.js b/models/cards.js
index 6896970c..670a47cb 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -186,6 +186,10 @@ Cards.helpers({
return this.checklistItemCount() !== 0;
},
+ customFieldIndex(customFieldId) {
+ return _.pluck(this.customFields, '_id').indexOf(customFieldId);
+ },
+
absoluteUrl() {
const board = this.board();
return FlowRouter.url('card', {
@@ -255,7 +259,7 @@ Cards.mutations({
assignCustomField(customFieldId) {
console.log("assignCustomField", customFieldId);
- return {$push: {customFields: {_id: customFieldId, value: null}}};
+ return {$addToSet: {customFields: {_id: customFieldId, value: null}}};
},
unassignCustomField(customFieldId) {
@@ -264,7 +268,7 @@ Cards.mutations({
},
toggleCustomField(customFieldId) {
- if (this.customFields && this.customFields[customFieldId]) {
+ if (this.customFields && this.customFieldIndex(customFieldId) > -1) {
return this.unassignCustomField(customFieldId);
} else {
return this.assignCustomField(customFieldId);