From 6d6bb8fc5745300dedef85d4500e0a5ee3f9017f Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Fri, 8 Mar 2019 11:28:21 +0100 Subject: Activities: register customFields changed in the activities This stores the updates to the custom fields in the activities side bar. Only manual updates to the custom fields are currently registered. --- client/components/activities/activities.jade | 6 ++++++ client/components/activities/activities.js | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'client') diff --git a/client/components/activities/activities.jade b/client/components/activities/activities.jade index bddc4dad..949400f6 100644 --- a/client/components/activities/activities.jade +++ b/client/components/activities/activities.jade @@ -114,6 +114,12 @@ template(name="boardActivities") if($eq activityType 'removedLabel') | {{{_ 'activity-removed-label' lastLabel cardLink}}}. + if($eq activityType 'setCustomField') + | {{{_ 'activity-set-customfield' lastCustomField lastCustomFieldValue cardLink}}}. + + if($eq activityType 'unsetCustomField') + | {{{_ 'activity-unset-customfield' lastCustomField cardLink}}}. + if($eq activityType 'unjoinMember') if($eq user._id member._id) | {{{_ 'activity-unjoined' cardLink}}}. diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js index b3fe8f50..81995221 100644 --- a/client/components/activities/activities.js +++ b/client/components/activities/activities.js @@ -82,6 +82,24 @@ BlazeComponent.extendComponent({ } }, + lastCustomField(){ + const lastCustomField = CustomFields.findOne(this.currentData().customFieldId); + return lastCustomField.name; + }, + + lastCustomFieldValue(){ + const lastCustomField = CustomFields.findOne(this.currentData().customFieldId); + const value = this.currentData().value; + if (lastCustomField.settings.dropdownItems && lastCustomField.settings.dropdownItems.length > 0) { + const dropDownValue = _.find(lastCustomField.settings.dropdownItems, (item) => { + return item._id === value; + }); + if (dropDownValue) + return dropDownValue.name; + } + return value; + }, + listLabel() { return this.currentData().list().title; }, -- cgit v1.2.3-1-g7c22 From 97822f35fd6365e5631c5488e8ee595f76ab4e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Fri, 8 Mar 2019 20:41:20 +0100 Subject: Avoid set self as parent card, for real --- client/components/cards/cardDetails.jade | 10 ++++---- client/components/cards/cardDetails.js | 39 +++++++++++++------------------- 2 files changed, 21 insertions(+), 28 deletions(-) (limited to 'client') diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index df76edce..5fd7b748 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -306,27 +306,27 @@ template(name="cardMorePopup") h2 {{_ 'change-card-parent'}} label {{_ 'source-board'}}: select.js-field-parent-board + if isTopLevel + option(value="none" selected) {{_ 'custom-field-dropdown-none'}} + else + option(value="none") {{_ 'custom-field-dropdown-none'}} each boards if isParentBoard option(value="{{_id}}" selected) {{title}} else option(value="{{_id}}") {{title}} - if isTopLevel - option(value="none" selected) {{_ 'custom-field-dropdown-none'}} - else - option(value="none") {{_ 'custom-field-dropdown-none'}} label {{_ 'parent-card'}}: select.js-field-parent-card if isTopLevel option(value="none" selected) {{_ 'custom-field-dropdown-none'}} else + option(value="none") {{_ 'custom-field-dropdown-none'}} each cards if isParentCard option(value="{{_id}}" selected) {{title}} else option(value="{{_id}}") {{title}} - option(value="none") {{_ 'custom-field-dropdown-none'}} br | {{_ 'added'}} span.date(title=card.createdAt) {{ moment createdAt 'LLL' }} diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 9b47531f..d27fe732 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -578,11 +578,14 @@ BlazeComponent.extendComponent({ BlazeComponent.extendComponent({ onCreated() { this.currentCard = this.currentData(); + this.parentBoard = new ReactiveVar(null); this.parentCard = this.currentCard.parentCard(); if (this.parentCard) { - this.parentBoard = this.parentCard.board(); + const list = $('.js-field-parent-card'); + list.val(this.parentCard._id); + this.parentBoard.set(this.parentCard.board()._id); } else { - this.parentBoard = null; + this.parentBoard.set(null); } }, @@ -601,9 +604,9 @@ BlazeComponent.extendComponent({ cards() { const currentId = Session.get('currentCard'); - if (this.parentBoard) { + if (this.parentBoard.get()) { return Cards.find({ - boardId: this.parentBoard, + boardId: this.parentBoard.get(), _id: {$ne: currentId}, }); } else { @@ -613,8 +616,8 @@ BlazeComponent.extendComponent({ isParentBoard() { const board = this.currentData(); - if (this.parentBoard) { - return board._id === this.parentBoard; + if (this.parentBoard.get()) { + return board._id === this.parentBoard.get(); } return false; }, @@ -628,11 +631,10 @@ BlazeComponent.extendComponent({ }, setParentCardId(cardId) { - if (cardId === 'null') { - cardId = null; - this.parentCard = null; - } else { + if (cardId) { this.parentCard = Cards.findOne(cardId); + } else { + this.parentCard = null; } this.currentCard.setParentId(cardId); }, @@ -669,23 +671,14 @@ BlazeComponent.extendComponent({ 'change .js-field-parent-board'(evt) { const selection = $(evt.currentTarget).val(); const list = $('.js-field-parent-card'); - list.empty(); if (selection === 'none') { - this.parentBoard = null; - list.prop('disabled', true); + this.parentBoard.set(null); } else { - this.parentBoard = Boards.findOne(selection); - this.parentBoard.cards().forEach(function(card) { - list.append( - $('').val(card._id).html(card.title) - ); - }); + subManager.subscribe('board', $(evt.currentTarget).val()); + this.parentBoard.set(selection); list.prop('disabled', false); } - list.append( - `` - ); - this.setParentCardId('null'); + this.setParentCardId(null); }, 'change .js-field-parent-card'(evt) { const selection = $(evt.currentTarget).val(); -- cgit v1.2.3-1-g7c22 From 8f337f17e45f8af8d96b6043d54466e5878b7e0b Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 11 Mar 2019 19:32:58 +0200 Subject: - Order All Boards by starred, color, board name and board description. Part 2. Thanks to xet7 ! --- client/components/boards/boardsList.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'client') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index 74a8e4d4..fcd1a6ce 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -26,11 +26,8 @@ BlazeComponent.extendComponent({ 'members.userId': Meteor.userId(), type: 'board', subtasksDefaultListId: null, - }, { - sort: { stars: -1, color: 1, title: 1, description: 1 }, - }); + }, { sort: [['stars', 'desc'], ['color', 'asc'], ['title', 'asc'], ['description', 'asc']] }); }, - isStarred() { const user = Meteor.user(); return user && user.hasStarred(this.currentData()._id); -- cgit v1.2.3-1-g7c22 From afda0ed4da3e0ee37b4f0227a108b96f5d8f624d Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 11 Mar 2019 19:56:17 +0200 Subject: Try to get ordering of All Boards working so that it does not keep reordering. Thanks to bentiss, with Apache I-CLA. Related #2241 --- client/components/boards/boardsList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index fcd1a6ce..3a49a8bf 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -26,7 +26,7 @@ BlazeComponent.extendComponent({ 'members.userId': Meteor.userId(), type: 'board', subtasksDefaultListId: null, - }, { sort: [['stars', 'desc'], ['color', 'asc'], ['title', 'asc'], ['description', 'asc']] }); + }, { sort: [['stars', 'desc'], ['color', 'asc'], ['title', 'asc'], ['description', 'asc'], ['_id', 'asc']] }); }, isStarred() { const user = Meteor.user(); -- cgit v1.2.3-1-g7c22