Browse Source

Use Popup.back() instead of Popup.close() to get no conflicts if a Popup is opened as "Sub Popup"

- .back() is also .close() if there is no "popup layer" left
Martin Filser 3 years ago
parent
commit
b9250e4be4

+ 1 - 1
client/components/boards/boardArchive.js

@@ -34,7 +34,7 @@ BlazeComponent.extendComponent({
           Utils.goBoardId(board._id);
         },
         'click .js-delete-board': Popup.afterConfirm('boardDelete', function() {
-          Popup.close();
+          Popup.back();
           const isSandstorm =
             Meteor.settings &&
             Meteor.settings.public &&

+ 14 - 14
client/components/boards/boardHeader.js

@@ -7,11 +7,11 @@ Template.boardMenuPopup.events({
   'click .js-rename-board': Popup.open('boardChangeTitle'),
   'click .js-custom-fields'() {
     Sidebar.setView('customFields');
-    Popup.close();
+    Popup.back();
   },
   'click .js-open-archives'() {
     Sidebar.setView('archives');
-    Popup.close();
+    Popup.back();
   },
   'click .js-change-board-color': Popup.open('boardChangeColor'),
   'click .js-change-language': Popup.open('changeLanguage'),
@@ -24,7 +24,7 @@ Template.boardMenuPopup.events({
   }),
   'click .js-delete-board': Popup.afterConfirm('deleteBoard', function() {
     const currentBoard = Boards.findOne(Session.get('currentBoard'));
-    Popup.close();
+    Popup.back();
     Boards.remove(currentBoard._id);
     FlowRouter.go('home');
   }),
@@ -47,7 +47,7 @@ Template.boardChangeTitlePopup.events({
     if (newTitle) {
       this.rename(newTitle);
       this.setDescription(newDesc);
-      Popup.close();
+      Popup.back();
     }
     event.preventDefault();
   },
@@ -173,15 +173,15 @@ Template.boardHeaderBar.helpers({
 Template.boardChangeViewPopup.events({
   'click .js-open-lists-view'() {
     Utils.setBoardView('board-view-lists');
-    Popup.close();
+    Popup.back();
   },
   'click .js-open-swimlanes-view'() {
     Utils.setBoardView('board-view-swimlanes');
-    Popup.close();
+    Popup.back();
   },
   'click .js-open-cal-view'() {
     Utils.setBoardView('board-view-cal');
-    Popup.close();
+    Popup.back();
   },
 });
 
@@ -327,7 +327,7 @@ BlazeComponent.extendComponent({
     const currentBoard = Boards.findOne(Session.get('currentBoard'));
     const visibility = this.currentData();
     currentBoard.setVisibility(visibility);
-    Popup.close();
+    Popup.back();
   },
 
   events() {
@@ -360,7 +360,7 @@ BlazeComponent.extendComponent({
             Session.get('currentBoard'),
             level,
             (err, ret) => {
-              if (!err && ret) Popup.close();
+              if (!err && ret) Popup.back();
             },
           );
         },
@@ -432,7 +432,7 @@ BlazeComponent.extendComponent({
           const direction = down ? -1 : 1;
           this.setSortBy([sortby, direction]);
           if (Utils.isMiniScreen) {
-            Popup.close();
+            Popup.back();
           }
         },
       },
@@ -451,7 +451,7 @@ BlazeComponent.extendComponent({
           };
           Session.set('sortBy', sortBy);
           sortCardsBy.set(TAPi18n.__('due-date'));
-          Popup.close();
+          Popup.back();
         },
         'click .js-sort-title'() {
           const sortBy = {
@@ -459,7 +459,7 @@ BlazeComponent.extendComponent({
           };
           Session.set('sortBy', sortBy);
           sortCardsBy.set(TAPi18n.__('title'));
-          Popup.close();
+          Popup.back();
         },
         'click .js-sort-created-asc'() {
           const sortBy = {
@@ -467,7 +467,7 @@ BlazeComponent.extendComponent({
           };
           Session.set('sortBy', sortBy);
           sortCardsBy.set(TAPi18n.__('date-created-newest-first'));
-          Popup.close();
+          Popup.back();
         },
         'click .js-sort-created-desc'() {
           const sortBy = {
@@ -475,7 +475,7 @@ BlazeComponent.extendComponent({
           };
           Session.set('sortBy', sortBy);
           sortCardsBy.set(TAPi18n.__('date-created-oldest-first'));
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 1 - 1
client/components/cards/minicard.js

@@ -106,7 +106,7 @@ BlazeComponent.extendComponent({
           if (!Number.isNaN(sort)) {
             let card = this.data();
             card.move(card.boardId, card.swimlaneId, card.listId, sort);
-            Popup.close();
+            Popup.back();
           }
         },
       }

+ 6 - 6
client/components/lists/listBody.js

@@ -496,7 +496,7 @@ BlazeComponent.extendComponent({
           evt.preventDefault();
           const linkedId = $('.js-select-cards option:selected').val();
           if (!linkedId) {
-            Popup.close();
+            Popup.back();
             return;
           }
           const _id = Cards.insert({
@@ -511,7 +511,7 @@ BlazeComponent.extendComponent({
             linkedId,
           });
           Filter.addException(_id);
-          Popup.close();
+          Popup.back();
         },
         'click .js-link-board'(evt) {
           //LINK BOARD
@@ -522,7 +522,7 @@ BlazeComponent.extendComponent({
             !impBoardId ||
             Cards.findOne({ linkedId: impBoardId, archived: false })
           ) {
-            Popup.close();
+            Popup.back();
             return;
           }
           const _id = Cards.insert({
@@ -537,7 +537,7 @@ BlazeComponent.extendComponent({
             linkedId: impBoardId,
           });
           Filter.addException(_id);
-          Popup.close();
+          Popup.back();
         },
       },
     ];
@@ -584,7 +584,7 @@ BlazeComponent.extendComponent({
       });
     }
     if (!board) {
-      Popup.close();
+      Popup.back();
       return;
     }
     const boardId = board._id;
@@ -711,7 +711,7 @@ BlazeComponent.extendComponent({
               },
             );
           }
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 6 - 6
client/components/lists/listHeader.js

@@ -145,19 +145,19 @@ Template.listActionPopup.events({
   'click .js-select-cards'() {
     const cardIds = this.allCards().map(card => card._id);
     MultiSelection.add(cardIds);
-    Popup.close();
+    Popup.back();
   },
   'click .js-toggle-watch-list'() {
     const currentList = this;
     const level = currentList.findWatcher(Meteor.userId()) ? null : 'watching';
     Meteor.call('watch', 'list', currentList._id, level, (err, ret) => {
-      if (!err && ret) Popup.close();
+      if (!err && ret) Popup.back();
     });
   },
   'click .js-close-list'(event) {
     event.preventDefault();
     this.archive();
-    Popup.close();
+    Popup.back();
   },
   'click .js-set-wip-limit': Popup.open('setWipLimit'),
   'click .js-more': Popup.open('listMore'),
@@ -233,7 +233,7 @@ BlazeComponent.extendComponent({
 
 Template.listMorePopup.events({
   'click .js-delete': Popup.afterConfirm('listDelete', function() {
-    Popup.close();
+    Popup.back();
     // TODO how can we avoid the fetch call?
     const allCards = this.allCards().fetch();
     const allCardIds = _.pluck(allCards, '_id');
@@ -299,11 +299,11 @@ BlazeComponent.extendComponent({
         },
         'click .js-submit'() {
           this.currentList.setColor(this.currentColor.get());
-          Popup.close();
+          Popup.back();
         },
         'click .js-remove-color'() {
           this.currentList.setColor(null);
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 2 - 2
client/components/main/dueCards.js

@@ -38,12 +38,12 @@ BlazeComponent.extendComponent({
       {
         'click .js-due-cards-view-me'() {
           Utils.setDueCardsView('me');
-          Popup.close();
+          Popup.back();
         },
 
         'click .js-due-cards-view-all'() {
           Utils.setDueCardsView('all');
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 1 - 1
client/components/rules/actions/cardActions.js

@@ -232,7 +232,7 @@ BlazeComponent.extendComponent({
         },
         'click .js-submit'() {
           this.colorButtonValue.set(this.currentColor.get());
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 1 - 1
client/components/rules/triggers/boardTriggers.js

@@ -116,6 +116,6 @@ Template.boardCardTitlePopup.events({
       .trim();
     Popup.getOpenerComponent().setNameFilter(title);
     event.preventDefault();
-    Popup.close();
+    Popup.back();
   },
 });

+ 13 - 13
client/components/settings/peopleBody.js

@@ -562,7 +562,7 @@ Template.editOrgPopup.events({
       );
     }
 
-    Popup.close();
+    Popup.back();
   },
 });
 
@@ -606,7 +606,7 @@ Template.editTeamPopup.events({
       );
     }
 
-    Popup.close();
+    Popup.back();
   },
 });
 
@@ -721,7 +721,7 @@ Template.editUserPopup.events({
           } else {
             usernameMessageElement.hide();
             emailMessageElement.hide();
-            Popup.close();
+            Popup.back();
           }
         },
       );
@@ -735,7 +735,7 @@ Template.editUserPopup.events({
           }
         } else {
           usernameMessageElement.hide();
-          Popup.close();
+          Popup.back();
         }
       });
     } else if (isChangeEmail) {
@@ -752,11 +752,11 @@ Template.editUserPopup.events({
             }
           } else {
             emailMessageElement.hide();
-            Popup.close();
+            Popup.back();
           }
         },
       );
-    } else Popup.close();
+    } else Popup.back();
   },
   'click #addUserOrg'(event) {
     event.preventDefault();
@@ -891,7 +891,7 @@ Template.newOrgPopup.events({
       orgWebsite,
       orgIsActive,
     );
-    Popup.close();
+    Popup.back();
   },
 });
 
@@ -917,7 +917,7 @@ Template.newTeamPopup.events({
       teamWebsite,
       teamIsActive,
     );
-    Popup.close();
+    Popup.back();
   },
 });
 
@@ -990,11 +990,11 @@ Template.newUserPopup.events({
         } else {
           usernameMessageElement.hide();
           emailMessageElement.hide();
-          Popup.close();
+          Popup.back();
         }
       },
     );
-    Popup.close();
+    Popup.back();
   },
   'click #addUserOrgNewUser'(event) {
     event.preventDefault();
@@ -1048,7 +1048,7 @@ Template.settingsOrgPopup.events({
       return;
     }
     Org.remove(this.orgId);
-    Popup.close();
+    Popup.back();
   }
 });
 
@@ -1066,7 +1066,7 @@ Template.settingsTeamPopup.events({
       return;
     }
     Team.remove(this.teamId);
-    Popup.close();
+    Popup.back();
   }
 });
 
@@ -1099,7 +1099,7 @@ Template.settingsUserPopup.events({
     //
     //
     */
-    Popup.close();
+    Popup.back();
   },
 });
 

+ 15 - 15
client/components/sidebar/sidebar.js

@@ -188,15 +188,15 @@ Template.boardMenuPopup.events({
   'click .js-rename-board': Popup.open('boardChangeTitle'),
   'click .js-open-rules-view'() {
     Modal.openWide('rulesMain');
-    Popup.close();
+    Popup.back();
   },
   'click .js-custom-fields'() {
     Sidebar.setView('customFields');
-    Popup.close();
+    Popup.back();
   },
   'click .js-open-archives'() {
     Sidebar.setView('archives');
-    Popup.close();
+    Popup.back();
   },
   'click .js-change-board-color': Popup.open('boardChangeColor'),
   'click .js-change-language': Popup.open('changeLanguage'),
@@ -209,7 +209,7 @@ Template.boardMenuPopup.events({
   }),
   'click .js-delete-board': Popup.afterConfirm('deleteBoard', function() {
     const currentBoard = Boards.findOne(Session.get('currentBoard'));
-    Popup.close();
+    Popup.back();
     Boards.remove(currentBoard._id);
     FlowRouter.go('home');
   }),
@@ -252,7 +252,7 @@ Template.boardMenuPopup.helpers({
 Template.memberPopup.events({
   'click .js-filter-member'() {
     Filter.members.toggle(this.userId);
-    Popup.close();
+    Popup.back();
   },
   'click .js-change-role': Popup.open('changePermissions'),
   'click .js-remove-member': Popup.afterConfirm('removeMember', function() {
@@ -266,12 +266,12 @@ Template.memberPopup.events({
       card.unassignAssignee(memberId);
     });
     Boards.findOne(boardId).removeMember(memberId);
-    Popup.close();
+    Popup.back();
   }),
   'click .js-leave-member': Popup.afterConfirm('leaveBoard', () => {
     const boardId = Session.get('currentBoard');
     Meteor.call('quitBoard', boardId, () => {
-      Popup.close();
+      Popup.back();
       FlowRouter.go('home');
     });
   }),
@@ -460,7 +460,7 @@ BlazeComponent.extendComponent({
               activities: ['all'],
             });
           }
-          Popup.close();
+          Popup.back();
         },
       },
     ];
@@ -1229,7 +1229,7 @@ BlazeComponent.extendComponent({
       self.setLoading(false);
       if (err) self.setError(err.error);
       else if (ret.email) self.setError('email-sent');
-      else Popup.close();
+      else Popup.back();
     });
   },
 
@@ -1316,7 +1316,7 @@ BlazeComponent.extendComponent({
             }
           }
 
-          Popup.close();
+          Popup.back();
         },
       },
     ];
@@ -1380,10 +1380,10 @@ BlazeComponent.extendComponent({
 
           Meteor.call('setBoardOrgs', boardOrganizations, currentBoard._id);
 
-          Popup.close();
+          Popup.back();
         },
         'click #cancelLeaveBoardBtn'(){
-          Popup.close();
+          Popup.back();
         },
       },
     ];
@@ -1490,7 +1490,7 @@ BlazeComponent.extendComponent({
             }
           }
 
-          Popup.close();
+          Popup.back();
         },
       },
     ];
@@ -1581,10 +1581,10 @@ BlazeComponent.extendComponent({
 
           Meteor.call('setBoardTeams', boardTeams, members, currentBoard._id);
 
-          Popup.close();
+          Popup.back();
         },
         'click #cancelLeaveBoardTeamBtn'(){
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 6 - 6
client/components/sidebar/sidebarArchives.js

@@ -94,13 +94,13 @@ BlazeComponent.extendComponent({
         'click .js-delete-card': Popup.afterConfirm('cardDelete', function() {
           const cardId = this._id;
           Cards.remove(cardId);
-          Popup.close();
+          Popup.back();
         }),
         'click .js-delete-all-cards': Popup.afterConfirm('cardDelete', () => {
           this.archivedCards().forEach(card => {
             Cards.remove(card._id);
           });
-          Popup.close();
+          Popup.back();
         }),
 
         'click .js-restore-list'() {
@@ -115,13 +115,13 @@ BlazeComponent.extendComponent({
 
         'click .js-delete-list': Popup.afterConfirm('listDelete', function() {
           this.remove();
-          Popup.close();
+          Popup.back();
         }),
         'click .js-delete-all-lists': Popup.afterConfirm('listDelete', () => {
           this.archivedLists().forEach(list => {
             list.remove();
           });
-          Popup.close();
+          Popup.back();
         }),
 
         'click .js-restore-swimlane'() {
@@ -138,7 +138,7 @@ BlazeComponent.extendComponent({
           'swimlaneDelete',
           function() {
             this.remove();
-            Popup.close();
+            Popup.back();
           },
         ),
         'click .js-delete-all-swimlanes': Popup.afterConfirm(
@@ -147,7 +147,7 @@ BlazeComponent.extendComponent({
             this.archivedSwimlanes().forEach(swimlane => {
               swimlane.remove();
             });
-            Popup.close();
+            Popup.back();
           },
         ),
       },

+ 2 - 2
client/components/sidebar/sidebarCustomFields.js

@@ -283,7 +283,7 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
             } else {
               CustomFields.remove(customField._id);
             }
-            Popup.close();
+            Popup.back();
           },
         ),
       },
@@ -302,6 +302,6 @@ CreateCustomFieldPopup.register('createCustomFieldPopup');
   'submit'(evt) {
     const customFieldId = this._id;
     CustomFields.remove(customFieldId);
-    Popup.close();
+    Popup.back();
   }
 });*/

+ 4 - 4
client/components/sidebar/sidebarFilters.js

@@ -171,22 +171,22 @@ Template.multiselectionSidebar.helpers({
 Template.disambiguateMultiLabelPopup.events({
   'click .js-remove-label'() {
     mutateSelectedCards('removeLabel', this._id);
-    Popup.close();
+    Popup.back();
   },
   'click .js-add-label'() {
     mutateSelectedCards('addLabel', this._id);
-    Popup.close();
+    Popup.back();
   },
 });
 
 Template.disambiguateMultiMemberPopup.events({
   'click .js-unassign-member'() {
     mutateSelectedCards('assignMember', this._id);
-    Popup.close();
+    Popup.back();
   },
   'click .js-assign-member'() {
     mutateSelectedCards('unassignMember', this._id);
-    Popup.close();
+    Popup.back();
   },
 });
 

+ 4 - 4
client/components/swimlanes/swimlaneHeader.js

@@ -39,7 +39,7 @@ Template.swimlaneActionPopup.events({
   'click .js-close-swimlane'(event) {
     event.preventDefault();
     this.archive();
-    Popup.close();
+    Popup.back();
   },
   'click .js-move-swimlane': Popup.open('moveSwimlane'),
   'click .js-copy-swimlane': Popup.open('copySwimlane'),
@@ -88,7 +88,7 @@ BlazeComponent.extendComponent({
           // XXX ideally, we should move the popup to the newly
           // created swimlane so a user can add more than one swimlane
           // with a minimum of interactions
-          Popup.close();
+          Popup.back();
         },
         'click .js-swimlane-template': Popup.open('searchElement'),
       },
@@ -118,11 +118,11 @@ BlazeComponent.extendComponent({
         },
         'click .js-submit'() {
           this.currentSwimlane.setColor(this.currentColor.get());
-          Popup.close();
+          Popup.back();
         },
         'click .js-remove-color'() {
           this.currentSwimlane.setColor(null);
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 1 - 1
client/components/swimlanes/swimlanes.js

@@ -327,7 +327,7 @@ class MoveSwimlaneComponent extends BlazeComponent {
             boardId = bSelect.options[bSelect.selectedIndex].value;
             Meteor.call(this.serverMethod, this.currentSwimlane._id, boardId);
           }
-          Popup.close();
+          Popup.back();
         },
       },
     ];

+ 1 - 1
client/components/users/userAvatar.js

@@ -290,7 +290,7 @@ Template.cardMemberPopup.helpers({
 Template.cardMemberPopup.events({
   'click .js-remove-member'() {
     Cards.findOne(this.cardId).unassignMember(this.userId);
-    Popup.close();
+    Popup.back();
   },
   'click .js-edit-profile': Popup.open('editProfile'),
 });

+ 4 - 4
client/components/users/userHeader.js

@@ -34,10 +34,10 @@ Template.memberMenuPopup.helpers({
 
 Template.memberMenuPopup.events({
   'click .js-my-cards'() {
-    Popup.close();
+    Popup.back();
   },
   'click .js-due-cards'() {
-    Popup.close();
+    Popup.back();
   },
   'click .js-open-archived-board'() {
     Modal.open('archivedBoards');
@@ -53,7 +53,7 @@ Template.memberMenuPopup.events({
     AccountsTemplates.logout();
   },
   'click .js-go-setting'() {
-    Popup.close();
+    Popup.back();
   },
 });
 
@@ -155,7 +155,7 @@ Template.editProfilePopup.events({
     } else Popup.back();
   },
   'click #deleteButton': Popup.afterConfirm('userDelete', function() {
-    Popup.close();
+    Popup.back();
     Users.remove(Meteor.userId());
     AccountsTemplates.logout();
   }),