diff options
author | Lauri Ojansivu <x@xet7.org> | 2018-06-14 19:38:16 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2018-06-14 19:38:16 +0300 |
commit | 85e02010d444453a4a682770522a65fcdc488c8b (patch) | |
tree | 4bdc971df59353fb2dffd03b6454ca0a4ef6cb16 /models | |
parent | fa82efe7d24a18afbd99ba805bdc3666cf3ba863 (diff) | |
parent | aeec9f6ef8d8de07c6c8b8001fe2bbeb012b9fa8 (diff) | |
download | wekan-85e02010d444453a4a682770522a65fcdc488c8b.tar.gz wekan-85e02010d444453a4a682770522a65fcdc488c8b.tar.bz2 wekan-85e02010d444453a4a682770522a65fcdc488c8b.zip |
Merge branch 'feuerball11-feature-custom-fields' into devel
Diffstat (limited to 'models')
-rw-r--r-- | models/cards.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/models/cards.js b/models/cards.js index 9236fcaa..00ec14c2 100644 --- a/models/cards.js +++ b/models/cards.js @@ -230,12 +230,26 @@ Cards.helpers({ // match right definition to each field if (!this.customFields) return []; return this.customFields.map((customField) => { + const definition = definitions.find((definition) => { + return definition._id === customField._id; + }); + //search for "True Value" which is for DropDowns other then the Value (which is the id) + let trueValue = customField.value; + if (definition.settings.dropdownItems && definition.settings.dropdownItems.length > 0) + { + for (let i = 0; i < definition.settings.dropdownItems.length; i++) + { + if (definition.settings.dropdownItems[i]._id === customField.value) + { + trueValue = definition.settings.dropdownItems[i].name; + } + } + } return { _id: customField._id, value: customField.value, - definition: definitions.find((definition) => { - return definition._id === customField._id; - }), + trueValue, + definition, }; }); |