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
This commit is contained in:
Martin Filser 2021-10-21 10:35:16 +02:00
parent a59dfa8fc0
commit b9250e4be4
17 changed files with 82 additions and 82 deletions

View file

@ -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();
},
},
];

View file

@ -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();
},
},
];