From 7c7640e63eaa09673ca668118293ae01e0d262e0 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Wed, 2 Feb 2022 23:34:38 +0100 Subject: [PATCH] Added Dropdown field "List" to card details --- client/components/cards/cardDetails.jade | 9 +++++++++ client/components/cards/cardDetails.js | 15 +++++++++++++++ client/components/sidebar/sidebar.jade | 6 ++++++ client/components/sidebar/sidebar.js | 20 ++++++++++++++++++++ i18n/en.i18n.json | 3 ++- models/boards.js | 12 ++++++++++++ 6 files changed, 64 insertions(+), 1 deletion(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 598c2aeda..4aafe6b98 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-th-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/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index 9635eb9e8..5d1f16bc9 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-th-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; diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 809d070de..596bd7aff 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -1144,5 +1144,6 @@ "moveChecklistPopup-title": "Move Checklist", "newlineBecomesNewChecklistItem": "Newline becomes new checklist item", "copyChecklist": "Copy Checklist", - "copyChecklistPopup-title": "Copy Checklist" + "copyChecklistPopup-title": "Copy Checklist", + "card-show-lists": "Card Show Lists" } diff --git a/models/boards.js b/models/boards.js index 278930b21..5ca2a8e5f 100644 --- a/models/boards.js +++ b/models/boards.js @@ -440,6 +440,14 @@ Boards.attachSchema( defaultValue: true, }, + allowsShowLists: { + /** + * Does the board allows show lists on the card? + */ + type: Boolean, + defaultValue: true, + }, + allowsAssignedBy: { /** * Does the board allows requested by? @@ -1370,6 +1378,10 @@ Boards.mutations({ return { $set: { allowsCardSortingByNumber } }; }, + setAllowsShowLists(allowsShowLists) { + return { $set: { allowsShowLists } }; + }, + setAllowsAttachments(allowsAttachments) { return { $set: { allowsAttachments } }; },