From 8ec60879dc1666e9129c5f690da06c2931135fc5 Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 10:55:53 +0200 Subject: [PATCH 1/7] hotfix public board --- client/components/boards/boardBody.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 456bf9b30..dfe7b8d27 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -88,11 +88,13 @@ BlazeComponent.extendComponent({ isViewSwimlanes() { const currentUser = Meteor.user(); + if (!currentUser) return false; return (currentUser.profile.boardView === 'board-view-swimlanes'); }, isViewLists() { const currentUser = Meteor.user(); + if (!currentUser) return true; return (currentUser.profile.boardView === 'board-view-lists'); }, From 259614b647c72773675541d3de8d0ff73006c299 Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 11:58:37 +0200 Subject: [PATCH 2/7] 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 b44021a6b..e63a185b5 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 9236fcaaa..484e442a8 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, }; }); From 571f55f904a9d37dec5895472439dbeadc5b82b2 Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 12:41:16 +0200 Subject: [PATCH 3/7] fixing search for dropdown fields, and error on loading board --- client/lib/filter.js | 206 +++++++++++++++++++++++-------------------- models/cards.js | 10 +-- 2 files changed, 116 insertions(+), 100 deletions(-) diff --git a/client/lib/filter.js b/client/lib/filter.js index fa139cfe9..db353ee69 100644 --- a/client/lib/filter.js +++ b/client/lib/filter.js @@ -145,6 +145,22 @@ class AdvancedFilter { return found._id; } + _fieldValueToId(field, value) + { + const found = CustomFields.findOne({ 'name': field }); + if (found.settings.dropdownItems && found.settings.dropdownItems.length > 0) + { + for (let i = 0; i < found.settings.dropdownItems.length; i++) + { + if (found.settings.dropdownItems[i].name === value) + { + return found.settings.dropdownItems[i]._id; + } + } + } + return value; + } + _arrayToSelector(commands) { try { //let changed = false; @@ -163,27 +179,27 @@ class AdvancedFilter { if (commands[i].cmd) { switch (commands[i].cmd) { case '(': - { - level++; - if (start === -1) start = i; - continue; - } + { + level++; + if (start === -1) start = i; + continue; + } case ')': - { - level--; - commands.splice(i, 1); - i--; - continue; - } - default: - { - if (level > 0) { - subcommands.push(commands[i]); + { + level--; commands.splice(i, 1); i--; continue; } - } + default: + { + if (level > 0) { + subcommands.push(commands[i]); + commands.splice(i, 1); + i--; + continue; + } + } } } } @@ -205,86 +221,86 @@ class AdvancedFilter { case '=': case '==': case '===': - { - const field = commands[i - 1].cmd; - const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': str }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const field = commands[i - 1].cmd; + const str = commands[i + 1].cmd; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': this._fieldValueToId(str) }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } case '!=': case '!==': - { - const field = commands[i - 1].cmd; - const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: str } }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const field = commands[i - 1].cmd; + const str = commands[i + 1].cmd; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: this._fieldValueToId(str) } }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } case '>': case 'gt': case 'Gt': case 'GT': - { - const field = commands[i - 1].cmd; - const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: str } }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const field = commands[i - 1].cmd; + const str = commands[i + 1].cmd; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: str } }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } case '>=': case '>==': case 'gte': case 'Gte': case 'GTE': - { - const field = commands[i - 1].cmd; - const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: str } }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const field = commands[i - 1].cmd; + const str = commands[i + 1].cmd; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: str } }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } case '<': case 'lt': case 'Lt': case 'LT': - { - const field = commands[i - 1].cmd; - const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: str } }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const field = commands[i - 1].cmd; + const str = commands[i + 1].cmd; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: str } }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } case '<=': case '<==': case 'lte': case 'Lte': case 'LTE': - { - const field = commands[i - 1].cmd; - const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: str } }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const field = commands[i - 1].cmd; + const str = commands[i + 1].cmd; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: str } }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } } } @@ -300,44 +316,44 @@ class AdvancedFilter { case 'OR': case '|': case '||': - { - const op1 = commands[i - 1]; - const op2 = commands[i + 1]; - commands[i] = { $or: [op1, op2] }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const op1 = commands[i - 1]; + const op2 = commands[i + 1]; + commands[i] = { $or: [op1, op2] }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } case 'and': case 'And': case 'AND': case '&': case '&&': - { - const op1 = commands[i - 1]; - const op2 = commands[i + 1]; - commands[i] = { $and: [op1, op2] }; - commands.splice(i - 1, 1); - commands.splice(i, 1); + { + const op1 = commands[i - 1]; + const op2 = commands[i + 1]; + commands[i] = { $and: [op1, op2] }; + commands.splice(i - 1, 1); + commands.splice(i, 1); //changed = true; - i--; - break; - } + i--; + break; + } case 'not': case 'Not': case 'NOT': case '!': - { - const op1 = commands[i + 1]; - commands[i] = { $not: op1 }; - commands.splice(i + 1, 1); + { + const op1 = commands[i + 1]; + commands[i] = { $not: op1 }; + commands.splice(i + 1, 1); //changed = true; - i--; - break; - } + i--; + break; + } } } diff --git a/models/cards.js b/models/cards.js index 484e442a8..00ec14c29 100644 --- a/models/cards.js +++ b/models/cards.js @@ -230,16 +230,16 @@ Cards.helpers({ // match right definition to each field if (!this.customFields) return []; return this.customFields.map((customField) => { - var definition = definitions.find((definition) => { + 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) - var trueValue = customField.value; - if (definition.settings.dropdownItems.length > 0) + let trueValue = customField.value; + if (definition.settings.dropdownItems && definition.settings.dropdownItems.length > 0) { - for (var i = 0; i < definition.settings.dropdownItems.length;i++) + for (let i = 0; i < definition.settings.dropdownItems.length; i++) { - if (definition.settings.dropdownItems[i]._id == customField.value) + if (definition.settings.dropdownItems[i]._id === customField.value) { trueValue = definition.settings.dropdownItems[i].name; } From 558539e21ba377ae979221e50eb6587132208c8d Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 12:49:59 +0200 Subject: [PATCH 4/7] trying to fix integer search --- client/lib/filter.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/lib/filter.js b/client/lib/filter.js index db353ee69..1ea67f4b7 100644 --- a/client/lib/filter.js +++ b/client/lib/filter.js @@ -224,7 +224,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': this._fieldValueToId(str) }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(str), parseInt(str, 10)]} }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; @@ -236,7 +236,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: this._fieldValueToId(str) } }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(str), parseInt(str, 10)]} } }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; @@ -250,7 +250,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: str } }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: parseInt(str, 10) } }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; @@ -265,7 +265,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: str } }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: parseInt(str, 10) } }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; @@ -279,7 +279,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: str } }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: parseInt(str, 10) } }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; @@ -294,7 +294,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: str } }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: parseInt(str, 10) } }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; From 6a154ee9b0a7a6b3239813404538a5a9934228e4 Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 12:56:29 +0200 Subject: [PATCH 5/7] correcting error in advanced filter --- client/lib/filter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/lib/filter.js b/client/lib/filter.js index 1ea67f4b7..ea1811de0 100644 --- a/client/lib/filter.js +++ b/client/lib/filter.js @@ -224,7 +224,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(str), parseInt(str, 10)]} }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; @@ -236,7 +236,7 @@ class AdvancedFilter { { const field = commands[i - 1].cmd; const str = commands[i + 1].cmd; - commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(str), parseInt(str, 10)]} } }; + commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} } }; commands.splice(i - 1, 1); commands.splice(i, 1); //changed = true; From c5f0e87dd09c68e5327a601af881c78ff723c8df Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 14:10:30 +0200 Subject: [PATCH 6/7] fix for not able to remove "Show on Card" --- client/components/sidebar/sidebarCustomFields.jade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/components/sidebar/sidebarCustomFields.jade b/client/components/sidebar/sidebarCustomFields.jade index def083e9e..fd31e5ac3 100644 --- a/client/components/sidebar/sidebarCustomFields.jade +++ b/client/components/sidebar/sidebarCustomFields.jade @@ -37,7 +37,7 @@ template(name="createCustomFieldPopup") each dropdownItems.get input.js-dropdown-item(type="text" value=name placeholder="") input.js-dropdown-item.last(type="text" value="" placeholder="{{_ 'custom-field-dropdown-options-placeholder'}}") - a.flex.js-field-show-on-card + a.flex.js-field-show-on-card(class="{{#if showOnCard}}is-checked{{/if}}") .materialCheckBox(class="{{#if showOnCard}}is-checked{{/if}}") span {{_ 'show-field-on-card'}} @@ -49,4 +49,4 @@ template(name="createCustomFieldPopup") template(name="deleteCustomFieldPopup") p {{_ "custom-field-delete-pop"}} - button.js-confirm.negate.full(type="submit") {{_ 'delete'}} \ No newline at end of file + button.js-confirm.negate.full(type="submit") {{_ 'delete'}} From fcf262cc9807c1e87e638ce6b0c6151ae2114f60 Mon Sep 17 00:00:00 2001 From: Ignatz Date: Thu, 14 Jun 2018 15:08:30 +0200 Subject: [PATCH 7/7] testing markdown support for custom fields --- client/components/cards/minicard.jade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index e63a185b5..c912ea70b 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -37,7 +37,8 @@ template(name="minicard") .minicard-custom-field-item = definition.name .minicard-custom-field-item - = trueValue + +viewer + = trueValue if members .minicard-members.js-minicard-members