diff options
author | Pouyan Savoli <papoola@hotmail.com> | 2017-08-30 02:54:54 +0200 |
---|---|---|
committer | Pouyan Savoli <papoola@hotmail.com> | 2017-09-22 22:59:32 +0200 |
commit | d87191f17ee1cd49def9ca5a4d3d1568b041e6a2 (patch) | |
tree | f5cb0645508dcb23aa2c50d0e93d18f39eb41a08 /models | |
parent | afd87e3caa1fedbe8fe5dbaefa485fee1ed85c71 (diff) | |
download | wekan-d87191f17ee1cd49def9ca5a4d3d1568b041e6a2.tar.gz wekan-d87191f17ee1cd49def9ca5a4d3d1568b041e6a2.tar.bz2 wekan-d87191f17ee1cd49def9ca5a4d3d1568b041e6a2.zip |
card model and card ui preparation for custom fields
Diffstat (limited to 'models')
-rw-r--r-- | models/cards.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/models/cards.js b/models/cards.js index 0a440697..6896970c 100644 --- a/models/cards.js +++ b/models/cards.js @@ -38,6 +38,21 @@ Cards.attachSchema(new SimpleSchema({ } }, }, + customFields: { + type: [Object], + optional: true, + }, + 'customFields.$': { + type: new SimpleSchema({ + _id: { + type: String, + }, + value: { + type: Match.OneOf(String,Number,Boolean,Date), + optional: true, + }, + }) + }, dateLastActivity: { type: Date, autoValue() { @@ -238,6 +253,24 @@ Cards.mutations({ } }, + assignCustomField(customFieldId) { + console.log("assignCustomField", customFieldId); + return {$push: {customFields: {_id: customFieldId, value: null}}}; + }, + + unassignCustomField(customFieldId) { + console.log("unassignCustomField", customFieldId); + return {$pull: {customFields: {_id: customFieldId}}}; + }, + + toggleCustomField(customFieldId) { + if (this.customFields && this.customFields[customFieldId]) { + return this.unassignCustomField(customFieldId); + } else { + return this.assignCustomField(customFieldId); + } + }, + setCover(coverId) { return {$set: {coverId}}; }, |