From b9178cfcb6ed34d6060784255d6b3db90688efe5 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Wed, 13 Oct 2021 13:49:15 +0200 Subject: [PATCH 01/26] isMiniScreen and showDesktopDragHandles centralized in class Utils - a lot of same code everywhere in many files, this is against the concept "don't repeat yourself" --- client/components/boards/boardBody.js | 14 +------ client/components/cards/minicard.jade | 6 +-- client/components/cards/minicard.js | 10 ----- client/components/lists/list.js | 28 +------------- client/components/lists/listHeader.jade | 2 +- client/components/lists/listHeader.js | 13 +------ .../components/swimlanes/swimlaneHeader.jade | 2 +- client/components/swimlanes/swimlaneHeader.js | 13 ------- client/components/swimlanes/swimlanes.js | 38 ++----------------- client/components/users/userHeader.jade | 2 +- client/components/users/userHeader.js | 10 ----- client/lib/utils.js | 2 + 12 files changed, 14 insertions(+), 126 deletions(-) diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 0195bb545..ad1078369 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -191,21 +191,11 @@ BlazeComponent.extendComponent({ }); this.autorun(() => { - let showDesktopDragHandles = false; - currentUser = Meteor.user(); - if (currentUser) { - showDesktopDragHandles = (currentUser.profile || {}) - .showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - showDesktopDragHandles = true; - } else { - showDesktopDragHandles = false; - } - if (Utils.isMiniScreen() || showDesktopDragHandles) { + if (Utils.isMiniScreenOrShowDesktopDragHandles()) { $swimlanesDom.sortable({ handle: '.js-swimlane-header-handle', }); - } else if (!Utils.isMiniScreen() && !showDesktopDragHandles) { + } else if (!Utils.isMiniScreen() && !Utils.isShowDesktopDragHandles()) { $swimlanesDom.sortable({ handle: '.swimlane-header', }); diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index e804b3e4c..d222ec925 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -3,13 +3,9 @@ template(name="minicard") class="{{#if isLinkedCard}}linked-card{{/if}}" class="{{#if isLinkedBoard}}linked-board{{/if}}" class="minicard-{{colorClass}}") - if isMiniScreen + if isMiniScreenOrShowDesktopDragHandles .handle .fa.fa-arrows - unless isMiniScreen - if showDesktopDragHandles - .handle - .fa.fa-arrows if cover .minicard-cover(style="background-image: url('{{cover.url}}');") if labels diff --git a/client/components/cards/minicard.js b/client/components/cards/minicard.js index 9bf687ef9..d0c4929c4 100644 --- a/client/components/cards/minicard.js +++ b/client/components/cards/minicard.js @@ -75,16 +75,6 @@ BlazeComponent.extendComponent({ }).register('minicard'); Template.minicard.helpers({ - showDesktopDragHandles() { - currentUser = Meteor.user(); - if (currentUser) { - return (currentUser.profile || {}).showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - return true; - } else { - return false; - } - }, hiddenMinicardLabelText() { currentUser = Meteor.user(); if (currentUser) { diff --git a/client/components/lists/list.js b/client/components/lists/list.js index 1cfbaff9a..f5446275d 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -117,22 +117,11 @@ BlazeComponent.extendComponent({ }); this.autorun(() => { - let showDesktopDragHandles = false; - currentUser = Meteor.user(); - if (currentUser) { - showDesktopDragHandles = (currentUser.profile || {}) - .showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - showDesktopDragHandles = true; - } else { - showDesktopDragHandles = false; - } - - if (Utils.isMiniScreen() || showDesktopDragHandles) { + if (Utils.isMiniScreenOrShowDesktopDragHandles()) { $cards.sortable({ handle: '.handle', }); - } else if (!Utils.isMiniScreen() && !showDesktopDragHandles) { + } else if (!Utils.isMiniScreen() && !Utils.isShowDesktopDragHandles()) { $cards.sortable({ handle: '.minicard', }); @@ -178,19 +167,6 @@ BlazeComponent.extendComponent({ }, }).register('list'); -Template.list.helpers({ - showDesktopDragHandles() { - currentUser = Meteor.user(); - if (currentUser) { - return (currentUser.profile || {}).showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - return true; - } else { - return false; - } - }, -}); - Template.miniList.events({ 'click .js-select-list'() { const listId = this._id; diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade index c01e9d616..866665308 100644 --- a/client/components/lists/listHeader.jade +++ b/client/components/lists/listHeader.jade @@ -44,7 +44,7 @@ template(name="listHeader") a.js-add-card.fa.fa-plus.list-header-plus-icon(title="{{_ 'add-card-to-top-of-list'}}") a.fa.fa-navicon.js-open-list-menu(title="{{_ 'listActionPopup-title'}}") if currentUser.isBoardAdmin - if showDesktopDragHandles + if isShowDesktopDragHandles a.list-header-handle.handle.fa.fa-arrows.js-list-handle template(name="editListTitleForm") diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index 91d6064cd..e9a8b2676 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -122,18 +122,7 @@ BlazeComponent.extendComponent({ Template.listHeader.helpers({ isBoardAdmin() { return Meteor.user().isBoardAdmin(); - }, - - showDesktopDragHandles() { - currentUser = Meteor.user(); - if (currentUser) { - return (currentUser.profile || {}).showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - return true; - } else { - return false; - } - }, + } }); Template.listActionPopup.helpers({ diff --git a/client/components/swimlanes/swimlaneHeader.jade b/client/components/swimlanes/swimlaneHeader.jade index 5319402c2..072b7ccee 100644 --- a/client/components/swimlanes/swimlaneHeader.jade +++ b/client/components/swimlanes/swimlaneHeader.jade @@ -26,7 +26,7 @@ template(name="swimlaneFixedHeader") a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon(title="{{_ 'add-swimlane'}}") a.fa.fa-navicon.js-open-swimlane-menu(title="{{_ 'swimlaneActionPopup-title'}}") unless isMiniScreen - if showDesktopDragHandles + if isShowDesktopDragHandles a.swimlane-header-handle.handle.fa.fa-arrows.js-swimlane-header-handle if isMiniScreen a.swimlane-header-miniscreen-handle.handle.fa.fa-arrows.js-swimlane-header-handle diff --git a/client/components/swimlanes/swimlaneHeader.js b/client/components/swimlanes/swimlaneHeader.js index 9d01ee34c..b941d46ed 100644 --- a/client/components/swimlanes/swimlaneHeader.js +++ b/client/components/swimlanes/swimlaneHeader.js @@ -28,19 +28,6 @@ BlazeComponent.extendComponent({ }, }).register('swimlaneHeader'); -Template.swimlaneHeader.helpers({ - showDesktopDragHandles() { - currentUser = Meteor.user(); - if (currentUser) { - return (currentUser.profile || {}).showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - return true; - } else { - return false; - } - }, -}); - Template.swimlaneFixedHeader.helpers({ isBoardAdmin() { return Meteor.user().isBoardAdmin(); diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index b6fe744b5..623bb857f 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -95,22 +95,11 @@ function initSortable(boardComponent, $listsDom) { //} boardComponent.autorun(() => { - let showDesktopDragHandles = false; - currentUser = Meteor.user(); - if (currentUser) { - showDesktopDragHandles = (currentUser.profile || {}) - .showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - showDesktopDragHandles = true; - } else { - showDesktopDragHandles = false; - } - - if (Utils.isMiniScreen() || showDesktopDragHandles) { + if (Utils.isMiniScreenOrShowDesktopDragHandles) { $listsDom.sortable({ handle: '.js-list-handle', }); - } else if (!Utils.isMiniScreen() && !showDesktopDragHandles) { + } else if (!Utils.isMiniScreen() && !Utils.isShowDesktopDragHandles()) { $listsDom.sortable({ handle: '.js-list-header', }); @@ -172,19 +161,8 @@ BlazeComponent.extendComponent({ // the user will legitimately expect to be able to select some text with // his mouse. - let showDesktopDragHandles = false; - currentUser = Meteor.user(); - if (currentUser) { - showDesktopDragHandles = (currentUser.profile || {}) - .showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - showDesktopDragHandles = true; - } else { - showDesktopDragHandles = false; - } - const noDragInside = ['a', 'input', 'textarea', 'p'].concat( - Utils.isMiniScreen() || showDesktopDragHandles + Utils.isMiniScreenOrShowDesktopDragHandles() ? ['.js-list-handle', '.js-swimlane-header-handle'] : ['.js-list-header'], ); @@ -264,16 +242,6 @@ BlazeComponent.extendComponent({ }).register('addListForm'); Template.swimlane.helpers({ - showDesktopDragHandles() { - currentUser = Meteor.user(); - if (currentUser) { - return (currentUser.profile || {}).showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - return true; - } else { - return false; - } - }, canSeeAddList() { return Meteor.user().isBoardAdmin(); /* diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade index 98e8c36b9..d5fe14739 100644 --- a/client/components/users/userHeader.jade +++ b/client/components/users/userHeader.jade @@ -134,7 +134,7 @@ template(name="changeSettingsPopup") a.js-toggle-desktop-drag-handles i.fa.fa-arrows | {{_ 'show-desktop-drag-handles'}} - if showDesktopDragHandles + if isShowDesktopDragHandles i.fa.fa-check unless currentUser.isWorker li diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index 7088e4309..1270eff39 100644 --- a/client/components/users/userHeader.js +++ b/client/components/users/userHeader.js @@ -259,16 +259,6 @@ Template.changeLanguagePopup.events({ }); Template.changeSettingsPopup.helpers({ - showDesktopDragHandles() { - currentUser = Meteor.user(); - if (currentUser) { - return (currentUser.profile || {}).showDesktopDragHandles; - } else if (window.localStorage.getItem('showDesktopDragHandles')) { - return true; - } else { - return false; - } - }, hiddenSystemMessages() { currentUser = Meteor.user(); if (currentUser) { diff --git a/client/lib/utils.js b/client/lib/utils.js index f8f684325..3c1e79f93 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -248,6 +248,8 @@ Utils = { const currentUser = Meteor.user(); if (currentUser) { return (currentUser.profile || {}).showDesktopDragHandles; + } else if (window.localStorage.getItem('showDesktopDragHandles')) { + return true; } else { return false; } From 4ab290928c1344e147bd8c86427618bf0dd092e4 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 19:54:12 +0200 Subject: [PATCH 02/26] minicard, div has no colorClass if not defined --- client/components/cards/minicard.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index d222ec925..45e48e996 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -2,7 +2,7 @@ template(name="minicard") .minicard( class="{{#if isLinkedCard}}linked-card{{/if}}" class="{{#if isLinkedBoard}}linked-board{{/if}}" - class="minicard-{{colorClass}}") + class="{{#if colorClass}}minicard-{{colorClass}}{{/if}}") if isMiniScreenOrShowDesktopDragHandles .handle .fa.fa-arrows From 09b127b64880f25be7d495fe666da30c8b2cb93b Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 19:53:01 +0200 Subject: [PATCH 03/26] Card Details as Popup --- client/components/cards/cardDetails.jade | 6 ++++-- client/components/cards/cardDetails.js | 15 ++++++++++----- client/components/cards/cardDetails.styl | 12 ++++++++++++ client/components/lists/listBody.jade | 23 ++++++++++++++++------- client/components/lists/listBody.js | 1 + client/components/main/popup.styl | 8 -------- i18n/en.i18n.json | 3 ++- 7 files changed, 45 insertions(+), 23 deletions(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index c400d4510..607e9eeb6 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -1,5 +1,8 @@ +template(name="cardDetailsPopup") + +cardDetails + template(name="cardDetails") - section.card-details.js-card-details(class='{{#if cardMaximized}}card-details-maximized{{/if}}'): .card-details-canvas + section.card-details.js-card-details(class='{{#if cardMaximized}}card-details-maximized{{/if}}' class='{{#if isMiniScreen}}card-details-popup{{/if}}'): .card-details-canvas .card-details-header(class='{{#if colorClass}}card-details-{{colorClass}}{{/if}}') +inlinedForm(classNames="js-card-details-title") +editCardTitleForm @@ -18,7 +21,6 @@ template(name="cardDetails") title="{{_ 'copy-card-link-to-clipboard'}}" ) if isMiniScreen - a.fa.fa-times-thin.close-card-details-mobile-web.js-close-card-details(title="{{_ 'close-card'}}") if currentUser.isBoardMember a.fa.fa-navicon.card-details-menu-mobile-web.js-open-card-details-menu(title="{{_ 'cardDetailsActionsPopup-title'}}") a.fa.fa-link.card-copy-mobile-button diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index e2493f5f4..349238290 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -34,11 +34,14 @@ BlazeComponent.extendComponent({ onCreated() { this.currentBoard = Boards.findOne(Session.get('currentBoard')); this.isLoaded = new ReactiveVar(false); - const boardBody = this.parentComponent().parentComponent(); - //in Miniview parent is Board, not BoardBody. - if (boardBody !== null) { - boardBody.showOverlay.set(true); - boardBody.mouseHasEnterCardDetails = false; + + if (this.parentComponent() && this.parentComponent().parentComponent()) { + const boardBody = this.parentComponent().parentComponent(); + //in Miniview parent is Board, not BoardBody. + if (boardBody !== null) { + boardBody.showOverlay.set(true); + boardBody.mouseHasEnterCardDetails = false; + } } this.calculateNextPeak(); @@ -297,6 +300,7 @@ BlazeComponent.extendComponent({ }, onDestroyed() { + if (this.parentComponent() === null) return; const parentComponent = this.parentComponent().parentComponent(); //on mobile view parent is Board, not board body. if (parentComponent === null) return; @@ -408,6 +412,7 @@ BlazeComponent.extendComponent({ 'click .js-show-positive-votes': Popup.open('positiveVoteMembers'), 'click .js-show-negative-votes': Popup.open('negativeVoteMembers'), 'mouseenter .js-card-details'() { + if (this.parentComponent() === null) return; const parentComponent = this.parentComponent().parentComponent(); //on mobile view parent is Board, not BoardBody. if (parentComponent === null) return; diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl index 9eb64da4e..e82cdec9a 100644 --- a/client/components/cards/cardDetails.styl +++ b/client/components/cards/cardDetails.styl @@ -315,6 +315,18 @@ input[type="submit"].attachment-add-link-submit .minimize-card-details margin-right: 40px + .card-details-popup + padding: 0px + + .pop-over > .content-wrapper > .popup-container-depth-0 + width: 100% + + & > .content + width: calc(100% - 10px) + + & > .content > .card-details-popup + overflow-y: auto + card-details-color(background, color...) background: background !important if color diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade index e1e921e70..d01e465bd 100644 --- a/client/components/lists/listBody.jade +++ b/client/components/lists/listBody.jade @@ -16,13 +16,22 @@ template(name="listBody") +viewer = formattedCurrencyCustomFieldValue(value) each (cardsWithLimit (idOrNull ../../_id)) - a.minicard-wrapper.js-minicard(href=originRelativeUrl - class="{{#if cardIsSelected}}is-selected{{/if}}" - class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") - if MultiSelection.isActive - .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection( - class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") - +minicard(this) + if isMiniScreen + a.minicard-wrapper.js-minicard.js-minicard-popup( + class="{{#if cardIsSelected}}is-selected{{/if}}" + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + if MultiSelection.isActive + .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection( + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + +minicard(this) + else + a.minicard-wrapper.js-minicard(href=originRelativeUrl + class="{{#if cardIsSelected}}is-selected{{/if}}" + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + if MultiSelection.isActive + .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection( + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + +minicard(this) if (showSpinner (idOrNull ../../_id)) +spinnerList diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index fcd28b644..167947dfe 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -220,6 +220,7 @@ BlazeComponent.extendComponent({ return [ { 'click .js-minicard': this.clickOnMiniCard, + 'click .js-minicard-popup': Popup.open("cardDetails"), 'click .js-toggle-multi-selection': this.toggleMultiSelection, 'click .open-minicard-composer': this.scrollToBottom, submit: this.addCard, diff --git a/client/components/main/popup.styl b/client/components/main/popup.styl index 91f5fa039..250510e8b 100644 --- a/client/components/main/popup.styl +++ b/client/components/main/popup.styl @@ -13,9 +13,6 @@ $popupWidth = 300px z-index: 99999 margin-top: 5px - hr - margin: 4px -10px - width: $popupWidth p, textarea, @@ -324,11 +321,6 @@ $popupWidth = 300px margin: 0px 0px border-bottom: 1px solid #eee - hr - width: 100% - height: 20px - margin: 0px 0px - color: #eee for depth in (1..6) .popup-container-depth-{depth} diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index e537db041..72abc2a37 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -1086,5 +1086,6 @@ "request": "Request", "requests": "Requests", "help-request": "Help Request", - "editCardSortOrderPopup-title": "Change Sorting" + "editCardSortOrderPopup-title": "Change Sorting", + "cardDetailsPopup-title": "Card Details" } From 4a87d5f0f3913c92423f5e50db94b205ba0ac68b Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 14:22:54 +0200 Subject: [PATCH 04/26] Card Details Popup, Labels and Checklistitems were too much displayed at the "bottom" --- client/components/main/popup.styl | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/components/main/popup.styl b/client/components/main/popup.styl index 250510e8b..5abee57ef 100644 --- a/client/components/main/popup.styl +++ b/client/components/main/popup.styl @@ -20,7 +20,6 @@ $popupWidth = 300px input[type="email"], input[type="password"], input[type="file"] - margin: 4px 0 12px width: 100% select @@ -310,7 +309,6 @@ $popupWidth = 300px input[type="email"], input[type="password"], input[type="file"] - margin: 4px 0 12px width: 100% box-sizing: border-box From 24b0613bacc47173324fad49338e04a1b84f5153 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 10:56:24 +0200 Subject: [PATCH 05/26] Card Details Popup, Checklist is now displayed --- client/components/cards/checklists.jade | 2 +- client/components/cards/checklists.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/components/cards/checklists.jade b/client/components/cards/checklists.jade index 6c7b517c7..e3e316a16 100644 --- a/client/components/cards/checklists.jade +++ b/client/components/cards/checklists.jade @@ -18,7 +18,7 @@ template(name="checklists") .card-checklist-items - each checklist in currentCard.checklists + each checklist in checklists +checklistDetail(checklist = checklist) if canModifyCard diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js index 0141f8ed5..4d6e95ba5 100644 --- a/client/components/cards/checklists.js +++ b/client/components/cards/checklists.js @@ -262,6 +262,11 @@ BlazeComponent.extendComponent({ }).register('boardsSwimlanesAndLists'); Template.checklists.helpers({ + checklists() { + const card = Cards.findOne(this.cardId); + const ret = card.checklists(); + return ret; + }, hideCheckedItems() { const currentUser = Meteor.user(); if (currentUser) return currentUser.hasHideCheckedItems(); From 0f69282eecb69e25a50737bf0d5528bae10f3f44 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 10:56:54 +0200 Subject: [PATCH 06/26] Card Details Popup, Activities (comments) are now displayed --- client/components/activities/activities.jade | 2 +- client/components/activities/activities.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/components/activities/activities.jade b/client/components/activities/activities.jade index 63d8d9222..6c9fb2e4c 100644 --- a/client/components/activities/activities.jade +++ b/client/components/activities/activities.jade @@ -12,7 +12,7 @@ template(name="boardActivities") +activity(activity=activityData card=card mode=mode) template(name="cardActivities") - each activityData in currentCard.activities + each activityData in activities +activity(activity=activityData card=card mode=mode) template(name="editOrDeleteComment") diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js index f8025d659..e8474c9b8 100644 --- a/client/components/activities/activities.js +++ b/client/components/activities/activities.js @@ -54,6 +54,13 @@ BlazeComponent.extendComponent({ }, }).register('activities'); +Template.activities.helpers({ + activities() { + const ret = this.card.activities(); + return ret; + }, +}); + BlazeComponent.extendComponent({ checkItem() { const checkItemId = this.currentData().activity.checklistItemId; From 5f58ede7e371b3c6314907291bbb596d8f8fc03e Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 13:06:57 +0200 Subject: [PATCH 07/26] Card Details Popup, edit of Checklist, Checklistitems and Description now works - problem is that if a inlined-form is opened within a popup, the popup is closed first --- client/lib/popup.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/client/lib/popup.js b/client/lib/popup.js index cae226594..cffeb266c 100644 --- a/client/lib/popup.js +++ b/client/lib/popup.js @@ -192,17 +192,21 @@ window.Popup = new (class { } })(); -// We close a potential opened popup on any left click on the document, or go -// one step back by pressing escape. -const escapeActions = ['back', 'close']; -escapeActions.forEach(actionName => { - EscapeActions.register( - `popup-${actionName}`, - () => Popup[actionName](), - () => Popup.isOpen(), - { - noClickEscapeOn: '.js-pop-over,.js-open-card-title-popup', - enabledOnClick: actionName === 'close', - }, - ); +Meteor.startup(() => { + if (!Utils.isMiniScreen()) { + // We close a potential opened popup on any left click on the document, or go + // one step back by pressing escape. + const escapeActions = ['back', 'close']; + escapeActions.forEach(actionName => { + EscapeActions.register( + `popup-${actionName}`, + () => Popup[actionName](), + () => Popup.isOpen(), + { + noClickEscapeOn: '.js-pop-over,.js-open-card-title-popup', + enabledOnClick: actionName === 'close', + }, + ); + }); + } }); From 125c84b6b557c63d9e8a5873f3179dfdc786e645 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 15:52:37 +0200 Subject: [PATCH 08/26] Card Details, Ctrl+Enter at description editing raised an error Console: Uncaught TypeError: can't access property "click", this.find(...) is null --- client/components/cards/cardDescription.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/components/cards/cardDescription.js b/client/components/cards/cardDescription.js index d83735861..c958c335e 100644 --- a/client/components/cards/cardDescription.js +++ b/client/components/cards/cardDescription.js @@ -25,7 +25,10 @@ BlazeComponent.extendComponent({ // Pressing Ctrl+Enter should submit the form 'keydown form textarea'(evt) { if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) { - this.find('button[type=submit]').click(); + const submitButton = this.find('button[type=submit]'); + if (submitButton) { + submitButton.click(); + } } }, }, From fb66b84b5826f983fa701e331417a6975bdd3960 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 18 Oct 2021 16:32:57 +0200 Subject: [PATCH 09/26] Card Details, description edit is now saved at popup --- client/components/cards/cardDetails.jade | 2 +- client/components/cards/cardDetails.js | 14 ++++++++++---- client/components/lists/listBody.js | 2 ++ client/config/blazeHelpers.js | 8 ++------ client/lib/utils.js | 21 +++++++++++++++++++++ 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 607e9eeb6..85b047780 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -1,5 +1,5 @@ template(name="cardDetailsPopup") - +cardDetails + +cardDetails(popupCard) template(name="cardDetails") section.card-details.js-card-details(class='{{#if cardMaximized}}card-details-maximized{{/if}}' class='{{#if isMiniScreen}}card-details-popup{{/if}}'): .card-details-canvas diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 349238290..f47806335 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -537,6 +537,13 @@ BlazeComponent.extendComponent({ }, }).register('cardDetails'); +Template.cardDetailsPopup.helpers({ + popupCard() { + const ret = Utils.getPopupCard(); + return ret; + }, +}); + BlazeComponent.extendComponent({ template() { return 'exportCard'; @@ -587,16 +594,15 @@ Template.editCardSortOrderForm.onRendered(function () { // XXX Recovering the currentCard identifier form a session variable is // fragile because this variable may change for instance if the route // change. We should use some component props instead. - docId: Session.get('currentCard'), + docId: Utils.getCurrentCardId(), }; } close(isReset = false) { if (this.isOpen.get() && !isReset) { const draft = this.getValue().trim(); - if ( - draft !== Cards.findOne(Session.get('currentCard')).getDescription() - ) { + let card = Utils.getCurrentCard(); + if (card && draft !== card.getDescription()) { UnsavedEdits.set(this._getUnsavedEditKey(), this.getValue()); } } diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 167947dfe..9afa5d47f 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -148,6 +148,8 @@ BlazeComponent.extendComponent({ // If the card is already selected, we want to de-select it. // XXX We should probably modify the minicard href attribute instead of // overwriting the event in case the card is already selected. + } else if (Utils.isMiniScreen()) { + Session.set('popupCard', this.currentData()._id); } else if (Session.equals('currentCard', this.currentData()._id)) { evt.stopImmediatePropagation(); evt.preventDefault(); diff --git a/client/config/blazeHelpers.js b/client/config/blazeHelpers.js index a4c610612..741b2fc58 100644 --- a/client/config/blazeHelpers.js +++ b/client/config/blazeHelpers.js @@ -8,12 +8,8 @@ Blaze.registerHelper('currentBoard', () => { }); Blaze.registerHelper('currentCard', () => { - const cardId = Session.get('currentCard'); - if (cardId) { - return Cards.findOne(cardId); - } else { - return null; - } + const ret = Utils.getCurrentCard(); + return ret; }); Blaze.registerHelper('currentList', () => { diff --git a/client/lib/utils.js b/client/lib/utils.js index 3c1e79f93..92e08b3f9 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -1,4 +1,25 @@ Utils = { + getCurrentCardId() { + let ret = Session.get('currentCard'); + if (!ret) { + ret = Utils.getPopupCardId(); + } + return ret; + }, + getPopupCardId() { + const ret = Session.get('popupCard'); + return ret; + }, + getCurrentCard() { + const cardId = Utils.getCurrentCardId(); + const ret = Cards.findOne(cardId); + return ret; + }, + getPopupCard() { + const cardId = Utils.getPopupCardId(); + const ret = Cards.findOne(cardId); + return ret; + }, reload () { // we move all window.location.reload calls into this function // so we can disable it when running tests. From dae58d11c2e725ab0a73baaa50b1b52453a7d04f Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 09:17:53 +0200 Subject: [PATCH 10/26] Card Details Popup only opened if not another popup is opened yet e.g. this Popup's didn't opened: - card sorting number - edit received date --- client/components/lists/listBody.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 9afa5d47f..0de2fcc36 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -218,11 +218,17 @@ BlazeComponent.extendComponent({ ); }, + cardDetailsPopup(event) { + if (!Popup.isOpen()) { + Popup.open("cardDetails")(event); + } + }, + events() { return [ { 'click .js-minicard': this.clickOnMiniCard, - 'click .js-minicard-popup': Popup.open("cardDetails"), + 'click .js-minicard-popup': this.cardDetailsPopup, 'click .js-toggle-multi-selection': this.toggleMultiSelection, 'click .open-minicard-composer': this.scrollToBottom, submit: this.addCard, From c07a1412f7764463ae42cff8f53067c20b3fc5d4 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 09:41:44 +0200 Subject: [PATCH 11/26] Card Details Popup and Sub-Popup's same look as the desktop view --- client/components/cards/cardDetails.styl | 5 ++++- client/components/main/popup.styl | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl index e82cdec9a..68688a238 100644 --- a/client/components/cards/cardDetails.styl +++ b/client/components/cards/cardDetails.styl @@ -316,7 +316,7 @@ input[type="submit"].attachment-add-link-submit margin-right: 40px .card-details-popup - padding: 0px + padding: 0px 10px .pop-over > .content-wrapper > .popup-container-depth-0 width: 100% @@ -327,6 +327,9 @@ input[type="submit"].attachment-add-link-submit & > .content > .card-details-popup overflow-y: auto + & hr + margin: 15px 0px + card-details-color(background, color...) background: background !important if color diff --git a/client/components/main/popup.styl b/client/components/main/popup.styl index 5abee57ef..24a864722 100644 --- a/client/components/main/popup.styl +++ b/client/components/main/popup.styl @@ -13,6 +13,8 @@ $popupWidth = 300px z-index: 99999 margin-top: 5px + hr + margin: 4px 0px p, textarea, @@ -315,10 +317,7 @@ $popupWidth = 300px .pop-over-list li > a width: calc(100% - 20px) - padding: 10px 10px margin: 0px 0px - border-bottom: 1px solid #eee - for depth in (1..6) .popup-container-depth-{depth} From 27213245eff99e76a3d1a6a9b9cf1a8a5833ce92 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 11:25:07 +0200 Subject: [PATCH 12/26] Card Details Popup, Session variable popupCard is deleted on popup close --- client/components/cards/cardDetails.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index f47806335..95d018d2c 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -537,6 +537,9 @@ BlazeComponent.extendComponent({ }, }).register('cardDetails'); +Template.cardDetailsPopup.onDestroyed(() => { + Session.delete('popupCard'); +}); Template.cardDetailsPopup.helpers({ popupCard() { const ret = Utils.getPopupCard(); From bcb5cfb2356234bec364eaa186881b139d8d2842 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 17:02:49 +0200 Subject: [PATCH 13/26] Card Details can be opened in a new tab on mobile view --- client/components/lists/listBody.jade | 23 +++++++---------------- client/components/lists/listBody.js | 3 ++- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade index d01e465bd..e1e921e70 100644 --- a/client/components/lists/listBody.jade +++ b/client/components/lists/listBody.jade @@ -16,22 +16,13 @@ template(name="listBody") +viewer = formattedCurrencyCustomFieldValue(value) each (cardsWithLimit (idOrNull ../../_id)) - if isMiniScreen - a.minicard-wrapper.js-minicard.js-minicard-popup( - class="{{#if cardIsSelected}}is-selected{{/if}}" - class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") - if MultiSelection.isActive - .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection( - class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") - +minicard(this) - else - a.minicard-wrapper.js-minicard(href=originRelativeUrl - class="{{#if cardIsSelected}}is-selected{{/if}}" - class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") - if MultiSelection.isActive - .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection( - class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") - +minicard(this) + a.minicard-wrapper.js-minicard(href=originRelativeUrl + class="{{#if cardIsSelected}}is-selected{{/if}}" + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + if MultiSelection.isActive + .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection( + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + +minicard(this) if (showSpinner (idOrNull ../../_id)) +spinnerList diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 0de2fcc36..aa33e65c7 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -149,7 +149,9 @@ BlazeComponent.extendComponent({ // XXX We should probably modify the minicard href attribute instead of // overwriting the event in case the card is already selected. } else if (Utils.isMiniScreen()) { + evt.preventDefault(); Session.set('popupCard', this.currentData()._id); + this.cardDetailsPopup(evt); } else if (Session.equals('currentCard', this.currentData()._id)) { evt.stopImmediatePropagation(); evt.preventDefault(); @@ -228,7 +230,6 @@ BlazeComponent.extendComponent({ return [ { 'click .js-minicard': this.clickOnMiniCard, - 'click .js-minicard-popup': this.cardDetailsPopup, 'click .js-toggle-multi-selection': this.toggleMultiSelection, 'click .open-minicard-composer': this.scrollToBottom, submit: this.addCard, From 48b2e3dd888b7a1131d3c0da009fe4b98498850e Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 17:07:41 +0200 Subject: [PATCH 14/26] Card Details in the new on mobile view have now the normal view again --- client/components/cards/cardDetails.jade | 4 +++- client/components/cards/cardDetails.js | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 85b047780..dd138f79a 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -2,7 +2,7 @@ template(name="cardDetailsPopup") +cardDetails(popupCard) template(name="cardDetails") - section.card-details.js-card-details(class='{{#if cardMaximized}}card-details-maximized{{/if}}' class='{{#if isMiniScreen}}card-details-popup{{/if}}'): .card-details-canvas + section.card-details.js-card-details(class='{{#if cardMaximized}}card-details-maximized{{/if}}' class='{{#if isPopup}}card-details-popup{{/if}}'): .card-details-canvas .card-details-header(class='{{#if colorClass}}card-details-{{colorClass}}{{/if}}') +inlinedForm(classNames="js-card-details-title") +editCardTitleForm @@ -21,6 +21,8 @@ template(name="cardDetails") title="{{_ 'copy-card-link-to-clipboard'}}" ) if isMiniScreen + unless isPopup + a.fa.fa-times-thin.close-card-details.js-close-card-details(title="{{_ 'close-card'}}") if currentUser.isBoardMember a.fa.fa-navicon.card-details-menu-mobile-web.js-open-card-details-menu(title="{{_ 'cardDetailsActionsPopup-title'}}") a.fa.fa-link.card-copy-mobile-button diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 95d018d2c..d665c08ed 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -537,6 +537,12 @@ BlazeComponent.extendComponent({ }, }).register('cardDetails'); +Template.cardDetails.helpers({ + isPopup() { + let ret = !!Utils.getPopupCardId(); + return ret; + } +}); Template.cardDetailsPopup.onDestroyed(() => { Session.delete('popupCard'); }); From 8c3ce4bb73bb564849e1f4b63b1ac85c6c996944 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 21:27:47 +0200 Subject: [PATCH 15/26] Card Details Popup possible on desktop view - until now a new form in the popup closed the popup itself --- client/components/cards/checklists.jade | 2 +- client/components/cards/checklists.js | 10 ++++++--- client/lib/inlinedform.js | 11 ++++++--- client/lib/popup.js | 30 +++++++++++-------------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/client/components/cards/checklists.jade b/client/components/cards/checklists.jade index e3e316a16..06f419282 100644 --- a/client/components/cards/checklists.jade +++ b/client/components/cards/checklists.jade @@ -25,7 +25,7 @@ template(name="checklists") +inlinedForm(autoclose=false classNames="js-add-checklist" cardId = cardId) +addChecklistItemForm else - a.js-open-inlined-form(title="{{_ 'add-checklist'}}") + a.add-checklist.js-open-inlined-form(title="{{_ 'add-checklist'}}") i.fa.fa-plus template(name="checklistDetail") diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js index 4d6e95ba5..86bd67541 100644 --- a/client/components/cards/checklists.js +++ b/client/components/cards/checklists.js @@ -94,16 +94,14 @@ BlazeComponent.extendComponent({ title, sort: card.checklists().count(), }); + this.closeAllInlinedForms(); setTimeout(() => { this.$('.add-checklist-item') .last() .click(); }, 100); } - textarea.value = ''; - textarea.focus(); }, - addChecklistItem(event) { event.preventDefault(); const textarea = this.find('textarea.js-add-checklist-item'); @@ -190,6 +188,10 @@ BlazeComponent.extendComponent({ } }, + closeAllInlinedForms() { + this.$('.js-close-inlined-form').click(); + }, + events() { const events = { 'click .toggle-delete-checklist-dialog'(event) { @@ -214,6 +216,8 @@ BlazeComponent.extendComponent({ 'click .js-delete-checklist-item': this.deleteItem, 'click .confirm-checklist-delete': this.deleteChecklist, 'focus .js-add-checklist-item': this.focusChecklistItem, + 'click .add-checklist-item.js-open-inlined-form': this.closeAllInlinedForms, + 'click .add-checklist.js-open-inlined-form': this.closeAllInlinedForms, keydown: this.pressKey, }, ]; diff --git a/client/lib/inlinedform.js b/client/lib/inlinedform.js index f2ebe31e0..b2f20d720 100644 --- a/client/lib/inlinedform.js +++ b/client/lib/inlinedform.js @@ -29,10 +29,15 @@ InlinedForm = BlazeComponent.extendComponent({ }, open(evt) { - evt && evt.preventDefault(); + if (evt) { + evt.preventDefault(); + // Close currently opened form, if any + EscapeActions.clickExecute(evt.target, 'inlinedForm'); + } else { + // Close currently opened form, if any + EscapeActions.executeUpTo('inlinedForm'); + } - // Close currently opened form, if any - EscapeActions.executeUpTo('inlinedForm'); this.isOpen.set(true); currentlyOpenedForm.set(this); }, diff --git a/client/lib/popup.js b/client/lib/popup.js index cffeb266c..fa9e125bb 100644 --- a/client/lib/popup.js +++ b/client/lib/popup.js @@ -192,21 +192,17 @@ window.Popup = new (class { } })(); -Meteor.startup(() => { - if (!Utils.isMiniScreen()) { - // We close a potential opened popup on any left click on the document, or go - // one step back by pressing escape. - const escapeActions = ['back', 'close']; - escapeActions.forEach(actionName => { - EscapeActions.register( - `popup-${actionName}`, - () => Popup[actionName](), - () => Popup.isOpen(), - { - noClickEscapeOn: '.js-pop-over,.js-open-card-title-popup', - enabledOnClick: actionName === 'close', - }, - ); - }); - } +// We close a potential opened popup on any left click on the document, or go +// one step back by pressing escape. +const escapeActions = ['back', 'close']; +escapeActions.forEach(actionName => { + EscapeActions.register( + `popup-${actionName}`, + () => Popup[actionName](), + () => Popup.isOpen(), + { + noClickEscapeOn: '.js-pop-over,.js-open-card-title-popup,.js-open-inlined-form', + enabledOnClick: actionName === 'close', + }, + ); }); From 4994f2313468a346316b43db6cc25d52adf1e0ed Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 21:48:03 +0200 Subject: [PATCH 16/26] textarea, remove every whitespace at line end - whitespaces aren't needed at the end of the line, that's why String.trim() is already implemented at input fields --- client/lib/inlinedform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/lib/inlinedform.js b/client/lib/inlinedform.js index b2f20d720..f0d2cc130 100644 --- a/client/lib/inlinedform.js +++ b/client/lib/inlinedform.js @@ -49,7 +49,7 @@ InlinedForm = BlazeComponent.extendComponent({ getValue() { const input = this.find('textarea,input[type=text]'); - return this.isOpen.get() && input && input.value; + return this.isOpen.get() && input && input.value.replaceAll(/\s +$/gm, ''); }, events() { From 7a6cfcb498d7bb8a2d64c98d9d575ada377ad991 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 23:32:19 +0200 Subject: [PATCH 17/26] Card Details Popup, Labels assign now works --- client/components/cards/labels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/cards/labels.js b/client/components/cards/labels.js index 1e156f542..cf86fa105 100644 --- a/client/components/cards/labels.js +++ b/client/components/cards/labels.js @@ -41,7 +41,7 @@ Template.createLabelPopup.helpers({ Template.cardLabelsPopup.events({ 'click .js-select-label'(event) { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const labelId = this._id; card.toggleLabel(labelId); event.preventDefault(); From fdf40f45847172d7e4d19b5ddf11159b4a9218bd Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 19 Oct 2021 23:55:25 +0200 Subject: [PATCH 18/26] Use Utils#getCurrentCard() everywhere in the code --- client/components/activities/activities.js | 2 +- client/components/activities/comments.js | 4 ++-- client/components/boards/boardBody.js | 2 +- client/components/boards/boardHeader.js | 2 +- client/components/cards/cardCustomFields.js | 8 ++++---- client/components/cards/cardDetails.js | 12 ++++++------ client/components/main/editor.js | 2 +- client/components/swimlanes/swimlanes.js | 6 +++--- client/components/users/userAvatar.js | 2 +- client/lib/keyboard.js | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js index e8474c9b8..de12987c8 100644 --- a/client/components/activities/activities.js +++ b/client/components/activities/activities.js @@ -15,7 +15,7 @@ BlazeComponent.extendComponent({ const capitalizedMode = Utils.capitalize(mode); let thisId, searchId; if (mode === 'linkedcard' || mode === 'linkedboard') { - thisId = Session.get('currentCard'); + thisId = Utils.getCurrentCardId(); searchId = Cards.findOne({ _id: thisId }).linkedId; mode = mode.replace('linked', ''); } else { diff --git a/client/components/activities/comments.js b/client/components/activities/comments.js index c69ec383e..b9165ce95 100644 --- a/client/components/activities/comments.js +++ b/client/components/activities/comments.js @@ -64,7 +64,7 @@ function resetCommentInput(input) { // Tracker.autorun to register the component dependencies, and re-run when these // dependencies are invalidated. A better component API would remove this hack. Tracker.autorun(() => { - Session.get('currentCard'); + Utils.getCurrentCardId(); Tracker.afterFlush(() => { autosize.update($('.js-new-comment-input')); }); @@ -75,7 +75,7 @@ EscapeActions.register( () => { const draftKey = { fieldName: 'cardComment', - docId: Session.get('currentCard'), + docId: Utils.getCurrentCardId(), }; const commentInput = $('.js-new-comment-input'); const draft = commentInput.val().trim(); diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index ad1078369..afe51305f 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -23,7 +23,7 @@ BlazeComponent.extendComponent({ }, onlyShowCurrentCard() { - return Utils.isMiniScreen() && Session.get('currentCard'); + return Utils.isMiniScreen() && Utils.getCurrentCardId(); }, goHome() { diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index c67c60f77..ef1a21fee 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -136,7 +136,7 @@ BlazeComponent.extendComponent({ Sidebar.setView('search'); }, 'click .js-multiselection-activate'() { - const currentCard = Session.get('currentCard'); + const currentCard = Utils.getCurrentCardId(); MultiSelection.activate(); if (currentCard) { MultiSelection.add(currentCard); diff --git a/client/components/cards/cardCustomFields.js b/client/components/cards/cardCustomFields.js index e1b0c7d28..eebdb3692 100644 --- a/client/components/cards/cardCustomFields.js +++ b/client/components/cards/cardCustomFields.js @@ -3,7 +3,7 @@ import Cards from '/models/cards'; Template.cardCustomFieldsPopup.helpers({ hasCustomField() { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const customFieldId = this._id; return card.customFieldIndex(customFieldId) > -1; }, @@ -11,7 +11,7 @@ Template.cardCustomFieldsPopup.helpers({ Template.cardCustomFieldsPopup.events({ 'click .js-select-field'(event) { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const customFieldId = this._id; card.toggleCustomField(customFieldId); event.preventDefault(); @@ -31,7 +31,7 @@ const CardCustomField = BlazeComponent.extendComponent({ onCreated() { const self = this; - self.card = Cards.findOne(Session.get('currentCard')); + self.card = Utils.getCurrentCard(); self.customFieldId = this.data()._id; }, @@ -194,7 +194,7 @@ CardCustomField.register('cardCustomField'); onCreated() { super.onCreated(); const self = this; - self.card = Cards.findOne(Session.get('currentCard')); + self.card = Utils.getCurrentCard(); self.customFieldId = this.data()._id; this.data().value && this.date.set(moment(this.data().value)); } diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index d665c08ed..31e4c9c75 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -806,7 +806,7 @@ Template.moveCardPopup.events({ 'click .js-done'() { // XXX We should *not* get the currentCard from the global state, but // instead from a “component” state. - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const bSelect = $('.js-select-boards')[0]; let boardId; // if we are a worker, we won't have a board select so we just use the @@ -864,7 +864,7 @@ BlazeComponent.extendComponent({ Template.copyCardPopup.events({ 'click .js-done'() { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const lSelect = $('.js-select-lists')[0]; const listId = lSelect.options[lSelect.selectedIndex].value; const slSelect = $('.js-select-swimlanes')[0]; @@ -893,7 +893,7 @@ Template.copyCardPopup.events({ Template.convertChecklistItemToCardPopup.events({ 'click .js-done'() { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const lSelect = $('.js-select-lists')[0]; const listId = lSelect.options[lSelect.selectedIndex].value; const slSelect = $('.js-select-swimlanes')[0]; @@ -921,7 +921,7 @@ Template.convertChecklistItemToCardPopup.events({ Template.copyChecklistToManyCardsPopup.events({ 'click .js-done'() { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const oldId = card._id; card._id = null; const lSelect = $('.js-select-lists')[0]; @@ -1040,7 +1040,7 @@ BlazeComponent.extendComponent({ }, cards() { - const currentId = Session.get('currentCard'); + const currentId = Utils.getCurrentCardId(); if (this.parentBoard.get()) { return Cards.find({ boardId: this.parentBoard.get(), @@ -1706,7 +1706,7 @@ Template.cardAssigneesPopup.onCreated(function () { Template.cardAssigneesPopup.events({ 'click .js-select-assignee'(event) { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const assigneeId = this.userId; card.toggleAssignee(assigneeId); event.preventDefault(); diff --git a/client/components/main/editor.js b/client/components/main/editor.js index 9c8cd0483..34ada0e24 100644 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -150,7 +150,7 @@ Template.editor.onRendered(() => { const $summernote = getSummernote(this); if (files && files.length > 0) { const image = files[0]; - const currentCard = Cards.findOne(Session.get('currentCard')); + const currentCard = Utils.getCurrentCard(); const MAX_IMAGE_PIXEL = Utils.MAX_IMAGE_PIXEL; const COMPRESS_RATIO = Utils.IMAGE_COMPRESS_RATIO; const insertImage = src => { diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 623bb857f..6cc129e8b 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -9,7 +9,7 @@ function currentListIsInThisSwimlane(swimlaneId) { } function currentCardIsInThisList(listId, swimlaneId) { - const currentCard = Cards.findOne(Session.get('currentCard')); + const currentCard = Utils.getCurrentCard(); const currentUser = Meteor.user(); if ( currentUser && @@ -125,7 +125,7 @@ BlazeComponent.extendComponent({ const boardComponent = this.parentComponent(); const $listsDom = this.$('.js-lists'); - if (!Session.get('currentCard')) { + if (!Utils.getCurrentCardId()) { boardComponent.scrollLeft(); } @@ -284,7 +284,7 @@ BlazeComponent.extendComponent({ const boardComponent = this.parentComponent(); const $listsDom = this.$('.js-lists'); - if (!Session.get('currentCard')) { + if (!Utils.getCurrentCardId()) { boardComponent.scrollLeft(); } diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js index 3fe008ca3..00e63fa7f 100644 --- a/client/components/users/userAvatar.js +++ b/client/components/users/userAvatar.js @@ -274,7 +274,7 @@ Template.cardMembersPopup.helpers({ Template.cardMembersPopup.events({ 'click .js-select-member'(event) { - const card = Cards.findOne(Session.get('currentCard')); + const card = Utils.getCurrentCard(); const memberId = this.userId; card.toggleMember(memberId); event.preventDefault(); diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js index 9f35009d3..4384fe135 100644 --- a/client/lib/keyboard.js +++ b/client/lib/keyboard.js @@ -54,7 +54,7 @@ Mousetrap.bind('/', () => { }); Mousetrap.bind(['down', 'up'], (evt, key) => { - if (!Session.get('currentCard')) { + if (!Utils.getCurrentCardId()) { return; } From a72f1ae8de7bb0f41071f8b79e8a4054b5af4b9b Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Wed, 20 Oct 2021 12:00:38 +0200 Subject: [PATCH 19/26] Card Details Popup close, list moved to top -> fixed --- client/components/boards/boardBody.js | 2 +- client/lib/utils.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index afe51305f..7db234d23 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -23,7 +23,7 @@ BlazeComponent.extendComponent({ }, onlyShowCurrentCard() { - return Utils.isMiniScreen() && Utils.getCurrentCardId(); + return Utils.isMiniScreen() && Utils.getCurrentCardId(true); }, goHome() { diff --git a/client/lib/utils.js b/client/lib/utils.js index 92e08b3f9..3e2cad868 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -1,7 +1,7 @@ Utils = { - getCurrentCardId() { + getCurrentCardId(ignorePopupCard) { let ret = Session.get('currentCard'); - if (!ret) { + if (!ret && !ignorePopupCard) { ret = Utils.getPopupCardId(); } return ret; @@ -10,8 +10,8 @@ Utils = { const ret = Session.get('popupCard'); return ret; }, - getCurrentCard() { - const cardId = Utils.getCurrentCardId(); + getCurrentCard(ignorePopupCard) { + const cardId = Utils.getCurrentCardId(ignorePopupCard); const ret = Cards.findOne(cardId); return ret; }, From 73872202ec5bad395f6d160bf44ae818938295a0 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Wed, 20 Oct 2021 08:38:51 +0200 Subject: [PATCH 20/26] Card Details mobile view, copy link contains now the URL/id to the current card --- client/components/cards/cardDetails.jade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index dd138f79a..0815191c0 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -25,7 +25,10 @@ template(name="cardDetails") a.fa.fa-times-thin.close-card-details.js-close-card-details(title="{{_ 'close-card'}}") if currentUser.isBoardMember a.fa.fa-navicon.card-details-menu-mobile-web.js-open-card-details-menu(title="{{_ 'cardDetailsActionsPopup-title'}}") - a.fa.fa-link.card-copy-mobile-button + a.fa.fa-link.card-copy-mobile-button( + class="fa-link" + title="{{_ 'copy-card-link-to-clipboard'}}" + ) h2.card-details-title.js-card-title( class="{{#if canModifyCard}}js-open-inlined-form is-editable{{/if}}") +viewer From ea7136816d2bddfd457904ba207d0aa76aa992be Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Wed, 20 Oct 2021 08:57:27 +0200 Subject: [PATCH 21/26] Card Details Popup, edit dates now closes not the Popup --- client/lib/datepicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/lib/datepicker.js b/client/lib/datepicker.js index ef5b91768..f57bcdaa3 100644 --- a/client/lib/datepicker.js +++ b/client/lib/datepicker.js @@ -120,7 +120,7 @@ export class DatePicker extends BlazeComponent { } if (newCompleteDate.isValid()) { this._storeDate(newCompleteDate.toDate()); - Popup.close(); + Popup.back(); } else if (!this.error) { this.error.set('invalid'); } @@ -128,7 +128,7 @@ export class DatePicker extends BlazeComponent { 'click .js-delete-date'(evt) { evt.preventDefault(); this._deleteDate(); - Popup.close(); + Popup.back(); }, }, ]; From b59e4d8fc77ceef8887f85b4ad0bf5861e05f7a0 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Wed, 20 Oct 2021 22:26:30 +0200 Subject: [PATCH 22/26] Swimlade, List drag/drop now works again happened at commit: b9178cfcb6ed34d6060784255d6b3db90688efe5 isMiniScreen and showDesktopDragHandles centralized in class Utils --- client/components/swimlanes/swimlanes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 6cc129e8b..15d4aa9f6 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -95,7 +95,7 @@ function initSortable(boardComponent, $listsDom) { //} boardComponent.autorun(() => { - if (Utils.isMiniScreenOrShowDesktopDragHandles) { + if (Utils.isMiniScreenOrShowDesktopDragHandles()) { $listsDom.sortable({ handle: '.js-list-handle', }); From 7ced602be4b38ad725e443d80dd6466ca08d67a8 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Wed, 20 Oct 2021 22:28:12 +0200 Subject: [PATCH 23/26] More robust logic if isMiniScreen or isShowDesktopDragHandles --- client/components/boards/boardBody.js | 2 +- client/components/lists/list.js | 2 +- client/components/swimlanes/swimlanes.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 7db234d23..81846f2ee 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -195,7 +195,7 @@ BlazeComponent.extendComponent({ $swimlanesDom.sortable({ handle: '.js-swimlane-header-handle', }); - } else if (!Utils.isMiniScreen() && !Utils.isShowDesktopDragHandles()) { + } else { $swimlanesDom.sortable({ handle: '.swimlane-header', }); diff --git a/client/components/lists/list.js b/client/components/lists/list.js index f5446275d..b5f829f25 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -121,7 +121,7 @@ BlazeComponent.extendComponent({ $cards.sortable({ handle: '.handle', }); - } else if (!Utils.isMiniScreen() && !Utils.isShowDesktopDragHandles()) { + } else { $cards.sortable({ handle: '.minicard', }); diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 15d4aa9f6..c099ed16e 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -99,7 +99,7 @@ function initSortable(boardComponent, $listsDom) { $listsDom.sortable({ handle: '.js-list-handle', }); - } else if (!Utils.isMiniScreen() && !Utils.isShowDesktopDragHandles()) { + } else { $listsDom.sortable({ handle: '.js-list-header', }); From bd2b8625fb838096dab8c613087544b0e910f283 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Thu, 21 Oct 2021 09:25:46 +0200 Subject: [PATCH 24/26] Set popupCard to null in router.js if currentCard is set to null --- config/router.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/router.js b/config/router.js index 372f17c7e..dec27ba21 100644 --- a/config/router.js +++ b/config/router.js @@ -12,6 +12,7 @@ FlowRouter.route('/', { Session.set('currentBoard', null); Session.set('currentList', null); Session.set('currentCard', null); + Session.set('popupCard', null); Filter.reset(); Session.set('sortBy', ''); @@ -34,6 +35,7 @@ FlowRouter.route('/public', { Session.set('currentBoard', null); Session.set('currentList', null); Session.set('currentCard', null); + Session.set('popupCard', null); Filter.reset(); Session.set('sortBy', ''); @@ -56,6 +58,7 @@ FlowRouter.route('/b/:id/:slug', { const previousBoard = Session.get('currentBoard'); Session.set('currentBoard', currentBoard); Session.set('currentCard', null); + Session.set('popupCard', null); // If we close a card, we'll execute again this route action but we don't // want to excape every current actions (filters, etc.) @@ -84,6 +87,7 @@ FlowRouter.route('/b/:boardId/:slug/:cardId', { Session.set('currentBoard', params.boardId); Session.set('currentCard', params.cardId); + Session.set('popupCard', null); Utils.manageCustomUI(); Utils.manageMatomo(); @@ -212,6 +216,7 @@ FlowRouter.route('/import/:source', { Session.set('currentBoard', null); Session.set('currentList', null); Session.set('currentCard', null); + Session.set('popupCard', null); Session.set('importSource', params.source); Filter.reset(); @@ -232,6 +237,7 @@ FlowRouter.route('/setting', { Session.set('currentBoard', null); Session.set('currentList', null); Session.set('currentCard', null); + Session.set('popupCard', null); Filter.reset(); Session.set('sortBy', ''); @@ -255,6 +261,7 @@ FlowRouter.route('/information', { Session.set('currentBoard', null); Session.set('currentList', null); Session.set('currentCard', null); + Session.set('popupCard', null); Filter.reset(); Session.set('sortBy', ''); @@ -277,6 +284,7 @@ FlowRouter.route('/people', { Session.set('currentBoard', null); Session.set('currentList', null); Session.set('currentCard', null); + Session.set('popupCard', null); Filter.reset(); Session.set('sortBy', ''); @@ -299,6 +307,7 @@ FlowRouter.route('/admin-reports', { Session.set('currentBoard', null); Session.set('currentList', null); Session.set('currentCard', null); + Session.set('popupCard', null); Filter.reset(); Session.set('sortBy', ''); From 21a3749086bea3764e9a8ace38b20c3af4bda49b Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Thu, 21 Oct 2021 09:41:47 +0200 Subject: [PATCH 25/26] Card Details Popup, Checklistitem Drag/Drop works in mobile view again --- client/components/cards/checklists.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js index 86bd67541..f2dc48dfd 100644 --- a/client/components/cards/checklists.js +++ b/client/components/cards/checklists.js @@ -16,7 +16,7 @@ function initSorting(items) { scroll: false, start(evt, ui) { ui.placeholder.height(ui.helper.height()); - EscapeActions.executeUpTo('popup-close'); + EscapeActions.clickExecute(evt.target, 'inlinedForm'); }, stop(evt, ui) { const parent = ui.item.parents('.js-checklist-items'); From 2af5e9c209e274d7821c244b9c72f9295c629a33 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Thu, 21 Oct 2021 09:45:46 +0200 Subject: [PATCH 26/26] Card Details Popup, Checklist Drag/Drop works in mobile view again --- client/components/cards/cardDetails.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 31e4c9c75..0e613e2be 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -218,7 +218,7 @@ BlazeComponent.extendComponent({ distance: 7, start(evt, ui) { ui.placeholder.height(ui.helper.height()); - EscapeActions.executeUpTo('popup-close'); + EscapeActions.clickExecute(evt.target, 'inlinedForm'); }, stop(evt, ui) { let prevChecklist = ui.item.prev('.js-checklist').get(0);