summaryrefslogtreecommitdiffstats
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
parentd87191f17ee1cd49def9ca5a4d3d1568b041e6a2 (diff)
downloadwekan-733b14dcd8f4b94047ffd444e7ab7ded49c245c0.tar.gz
wekan-733b14dcd8f4b94047ffd444e7ab7ded49c245c0.tar.bz2
wekan-733b14dcd8f4b94047ffd444e7ab7ded49c245c0.zip
card model and card ui preparation for custom fields #2
-rw-r--r--client/components/cards/cardDetails.styl7
-rw-r--r--models/cards.js8
2 files changed, 10 insertions, 5 deletions
diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl
index 5ad0c9f5..c981e2a2 100644
--- a/client/components/cards/cardDetails.styl
+++ b/client/components/cards/cardDetails.styl
@@ -71,16 +71,17 @@
.card-details-items
display: flex
flex-wrap: wrap
- margin: 15px 0
+ margin: 0 0 15px
.card-details-item
- margin-right: 0.5em
+ margin: 15px 0.5em 0 0
&:last-child
margin-right: 0
&.card-details-item-labels,
&.card-details-item-members,
&.card-details-item-start,
- &.card-details-item-due
+ &.card-details-item-due,
+ &.card-details-item-customfield
max-width: 50%
flex-grow: 1
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);