From d86eb74eb0e4a24a4a61f0c163c6f0888feb4bc6 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 18 Jan 2022 20:37:37 +0100 Subject: [PATCH] Move card popup restores now the last selected board value in dropdown menu --- client/components/cards/cardDetails.js | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index a7cbb9ac8..5e864a198 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -827,10 +827,9 @@ Template.moveCardPopup.events({ }); BlazeComponent.extendComponent({ onCreated() { - const boardId = Utils.getCurrentBoardId(); - subManager.subscribe('board', boardId, false); - this.selectedBoardId = new ReactiveVar(boardId); - this.setMoveAndCopyDialogOption(boardId); + this.currentBoardId = Utils.getCurrentBoardId(); + this.selectedBoardId = new ReactiveVar(this.currentBoardId); + this.setMoveAndCopyDialogOption(this.currentBoardId); }, /** set the last confirmed dialog field values @@ -846,7 +845,11 @@ BlazeComponent.extendComponent({ let currentOptions = Meteor.user().getMoveAndCopyDialogOptions(); if (currentOptions && boardId && currentOptions[boardId]) { this.moveAndCopyDialogOption = currentOptions[boardId]; + if (this.moveAndCopyDialogOption.boardId) { + this.selectedBoardId.set(this.moveAndCopyDialogOption.boardId) + } } + subManager.subscribe('board', this.selectedBoardId.get(), false); }, /** returns if the board id was the last confirmed one @@ -903,27 +906,26 @@ BlazeComponent.extendComponent({ return [ { 'click .js-done'() { - const bSelect = this.$('.js-select-boards')[0]; - const boardId = bSelect.options[bSelect.selectedIndex].value; + const boardSelect = this.$('.js-select-boards')[0]; + const boardId = boardSelect.options[boardSelect.selectedIndex].value; - const lSelect = this.$('.js-select-lists')[0]; - const listId = lSelect.options[lSelect.selectedIndex].value; + const listSelect = this.$('.js-select-lists')[0]; + const listId = listSelect.options[listSelect.selectedIndex].value; - const slSelect = this.$('.js-select-swimlanes')[0]; - const swimlaneId = slSelect.options[slSelect.selectedIndex].value; + const swimlaneSelect = this.$('.js-select-swimlanes')[0]; + const swimlaneId = swimlaneSelect.options[swimlaneSelect.selectedIndex].value; const options = { 'boardId' : boardId, 'swimlaneId' : swimlaneId, 'listId' : listId, } - Meteor.user().setMoveAndCopyDialogOption(boardId, options); + Meteor.user().setMoveAndCopyDialogOption(this.currentBoardId, options); }, 'change .js-select-boards'(event) { const boardId = $(event.currentTarget).val(); this.selectedBoardId.set(boardId); - this.setMoveAndCopyDialogOption(boardId); - subManager.subscribe('board', this.selectedBoardId.get(), false); + subManager.subscribe('board', boardId, false); }, }, ];