From 259614b647c72773675541d3de8d0ff73006c299 Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 11:58:37 +0200 Subject: trying to fix display Issue with dropdown custom fields --- client/components/cards/minicard.jade | 2 +- models/cards.js | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index b44021a6..e63a185b 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -37,7 +37,7 @@ template(name="minicard") .minicard-custom-field-item = definition.name .minicard-custom-field-item - = value + = trueValue if members .minicard-members.js-minicard-members diff --git a/models/cards.js b/models/cards.js index 9236fcaa..484e442a 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) => { + var 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) + var trueValue = customField.value; + if (definition.settings.dropdownItems.length > 0) + { + for (var 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, }; }); -- cgit v1.2.3-1-g7c22