From 265ee9ab839c1a458efa051937d7a68524ce94f5 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 7 Feb 2022 16:44:24 +0100 Subject: [PATCH 1/3] Added back Dropdown field "List" to card details --- client/components/cards/cardDetails.jade | 9 +++++++++ client/components/cards/cardDetails.js | 15 +++++++++++++++ client/components/cards/cardDetails.styl | 4 +--- client/components/sidebar/sidebar.jade | 6 ++++++ client/components/sidebar/sidebar.js | 20 ++++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 598c2aeda..2530739c8 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -234,6 +234,15 @@ template(name="cardDetails") +viewer = sort + if currentBoard.allowsShowLists + .card-details-item.card-details-show-lists + h3.card-details-item-title + i.fa.fa-list + | {{_ 'list'}} + select.js-select-lists + each currentBoard.lists + option(value="{{_id}}" selected="{{#if isCurrentListId _id}}selected{{/if}}") {{title}} + //.card-details-items if getSpentTime .card-details-item.card-details-item-spent diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 5e864a198..00c8ded9d 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -168,6 +168,15 @@ BlazeComponent.extendComponent({ ); }, + /** returns if the list id is the current list id + * @param listId list id to check + * @return is the list id the current list id ? + */ + isCurrentListId(listId) { + const ret = this.data().listId == listId; + return ret; + }, + onRendered() { if (Meteor.settings.public.CARD_OPENED_WEBHOOK_ENABLED) { // Send Webhook but not create Activities records --- @@ -379,6 +388,12 @@ BlazeComponent.extendComponent({ card.move(card.boardId, card.swimlaneId, card.listId, sort); } }, + 'change .js-select-lists'(event) { + let card = this.data(); + const listSelect = this.$('.js-select-lists')[0]; + const listId = listSelect.options[listSelect.selectedIndex].value; + card.move(card.boardId, card.swimlaneId, listId, card.sort); + }, 'click .js-go-to-linked-card'() { Utils.goCardId(this.data().linkedId); }, diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl index 6014097e4..bf939fe93 100644 --- a/client/components/cards/cardDetails.styl +++ b/client/components/cards/cardDetails.styl @@ -211,13 +211,13 @@ avatar-radius = 50% .card-details-item margin-right: 0.5em + flex-grow: 1 &:last-child margin-right: 0 &.card-details-item-labels display: block word-wrap: break-word max-width: 95% - flex-grow: 1 &.card-details-item-members, &.card-details-item-assignees, &.card-details-item-customfield, @@ -225,7 +225,6 @@ avatar-radius = 50% display: block word-wrap: break-word max-width: 36% - flex-grow: 1 &.card-details-item-creator, &.card-details-item-received, &.card-details-item-start, @@ -234,7 +233,6 @@ avatar-radius = 50% display: block word-wrap: break-word max-width: 28% - flex-grow: 1 &.custom-fields padding-left: 10px diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index 9635eb9e8..ef114a31f 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -203,6 +203,12 @@ template(name="boardCardSettingsPopup") span i.fa.fa-sort | {{_ 'card-sorting-by-number'}} + div.check-div + a.flex.js-field-has-card-show-lists(class="{{#if allowsShowLists}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsShowLists}}is-checked{{/if}}") + span + i.fa.fa-list + | {{_ 'card-show-lists'}} div.check-div a.flex.js-field-has-labels(class="{{#if allowsLabels}}is-checked{{/if}}") .materialCheckBox(class="{{#if allowsLabels}}is-checked{{/if}}") diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index c60d906a7..a1943a8f0 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -827,6 +827,10 @@ BlazeComponent.extendComponent({ return this.currentBoard.allowsCardSortingByNumber; }, + allowsShowLists() { + return this.currentBoard.allowsShowLists; + }, + allowsLabels() { return this.currentBoard.allowsLabels; }, @@ -1061,6 +1065,22 @@ BlazeComponent.extendComponent({ this.currentBoard.allowsCardSortingByNumber, ); }, + 'click .js-field-has-card-show-lists'(evt) { + evt.preventDefault(); + this.currentBoard.allowsShowLists = !this.currentBoard + .allowsShowLists; + this.currentBoard.setAllowsShowLists( + this.currentBoard.allowsShowLists, + ); + $(`.js-field-has-card-show-lists ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsShowLists, + ); + $('.js-field-has-card-show-lists').toggleClass( + CKCLS, + this.currentBoard.allowsShowLists, + ); + }, 'click .js-field-has-labels'(evt) { evt.preventDefault(); this.currentBoard.allowsLabels = !this.currentBoard.allowsLabels; From bd2739e78d361ddbc24824b3d7429fb609f7996e Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 7 Feb 2022 16:51:55 +0100 Subject: [PATCH 2/3] Fix Copy/Move Card Fixes: #4341, #4343 --- client/components/cards/cardDetails.jade | 2 +- client/components/cards/cardDetails.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 2530739c8..89f69d9eb 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -239,7 +239,7 @@ template(name="cardDetails") h3.card-details-item-title i.fa.fa-list | {{_ 'list'}} - select.js-select-lists + select.js-select-card-details-lists each currentBoard.lists option(value="{{_id}}" selected="{{#if isCurrentListId _id}}selected{{/if}}") {{title}} diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 00c8ded9d..c15dc299c 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -388,9 +388,9 @@ BlazeComponent.extendComponent({ card.move(card.boardId, card.swimlaneId, card.listId, sort); } }, - 'change .js-select-lists'(event) { + 'change .js-select-card-details-lists'(event) { let card = this.data(); - const listSelect = this.$('.js-select-lists')[0]; + const listSelect = this.$('.js-select-card-details-lists')[0]; const listId = listSelect.options[listSelect.selectedIndex].value; card.move(card.boardId, card.swimlaneId, listId, card.sort); }, From 4d89eb60834ebf095e167fcd2cc868950d5c7dcc Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Fri, 4 Feb 2022 13:47:15 +0100 Subject: [PATCH 3/3] Add protection to change the list of the card --- client/components/cards/cardDetails.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 89f69d9eb..5be3de8fd 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -239,7 +239,7 @@ template(name="cardDetails") h3.card-details-item-title i.fa.fa-list | {{_ 'list'}} - select.js-select-card-details-lists + select.js-select-card-details-lists(disabled="{{#unless canModifyCard}}disabled{{/unless}}") each currentBoard.lists option(value="{{_id}}" selected="{{#if isCurrentListId _id}}selected{{/if}}") {{title}}