Card Details Popup, every "Sub-Popup" must use .back() instead of .close()

- .close() closes the popup. Until now it was ok, but as the Card
  Details are opened in a popup too, .back() must be used to get the
  same behaviour back
- .back() is also .close() if there is no "popup layer" left
This commit is contained in:
Martin Filser 2021-10-21 10:12:55 +02:00
parent a6d3810e19
commit a59dfa8fc0
5 changed files with 51 additions and 77 deletions

View file

@ -269,7 +269,7 @@ Template.addReactionPopup.events({
const cardComment = CardComments.findOne({_id: commentId});
cardComment.toggleReaction(codepoint);
}
Popup.close();
Popup.back();
},
})

View file

@ -4,7 +4,7 @@ Template.attachmentsGalery.events({
'attachmentDelete',
function() {
Attachments.remove(this._id);
Popup.close();
Popup.back();
},
),
// If we let this event bubble, FlowRouter will handle it and empty the page
@ -53,7 +53,7 @@ Template.attachmentsGalery.helpers({
Template.previewAttachedImagePopup.events({
'click .js-large-image-clicked'() {
Popup.close();
Popup.back();
},
});
@ -65,7 +65,7 @@ Template.cardAttachmentsPopup.events({
if (attachment && attachment._id && attachment.isImage()) {
card.setCover(attachment._id);
}
Popup.close();
Popup.back();
});
};
@ -174,7 +174,7 @@ Template.previewClipboardImagePopup.events({
pastedResults = null;
$(document.body).pasteImageReader(() => {});
Popup.close();
Popup.back();
}
},
});

View file

@ -691,7 +691,7 @@ Template.cardDetailsActionsPopup.events({
this.move(this.boardId, this.swimlaneId, this.listId, maxOrder + 1);
},
'click .js-archive': Popup.afterConfirm('cardArchive', function () {
Popup.close();
Popup.back();
this.archive();
Utils.goBoardId(this.boardId);
}),
@ -700,7 +700,7 @@ Template.cardDetailsActionsPopup.events({
const currentCard = this;
const level = currentCard.findWatcher(Meteor.userId()) ? null : 'watching';
Meteor.call('watch', 'card', currentCard._id, level, (err, ret) => {
if (!err && ret) Popup.close();
if (!err && ret) Popup.back();
});
},
});
@ -819,7 +819,7 @@ Template.moveCardPopup.events({
const slSelect = $('.js-select-swimlanes')[0];
const swimlaneId = slSelect.options[slSelect.selectedIndex].value;
card.move(boardId, swimlaneId, listId, 0);
Popup.close();
Popup.back();
},
});
BlazeComponent.extendComponent({
@ -887,7 +887,7 @@ Template.copyCardPopup.events({
// See https://github.com/wekan/wekan/issues/80
Filter.addException(_id);
Popup.close();
Popup.back();
}
},
});
@ -914,7 +914,7 @@ Template.convertChecklistItemToCardPopup.events({
});
Filter.addException(_id);
Popup.close();
Popup.back();
}
},
@ -970,7 +970,7 @@ Template.copyChecklistToManyCardsPopup.events({
cmt.copy(_id);
});
}
Popup.close();
Popup.back();
}
},
});
@ -1000,11 +1000,11 @@ BlazeComponent.extendComponent({
},
'click .js-submit'() {
this.currentCard.setColor(this.currentColor.get());
Popup.close();
Popup.back();
},
'click .js-remove-color'() {
this.currentCard.setColor(null);
Popup.close();
Popup.back();
},
},
];
@ -1106,7 +1106,7 @@ BlazeComponent.extendComponent({
}
},
'click .js-delete': Popup.afterConfirm('cardDelete', function () {
Popup.close();
Popup.back();
// verify that there are no linked cards
if (Cards.find({ linkedId: this._id }).count() === 0) {
Cards.remove(this._id);
@ -1173,12 +1173,12 @@ BlazeComponent.extendComponent({
if (endString) {
this.currentCard.setVoteEnd(endString);
}
Popup.close();
Popup.back();
},
'click .js-remove-vote': Popup.afterConfirm('deleteVote', () => {
event.preventDefault();
this.currentCard.unsetVote();
Popup.close();
Popup.back();
}),
'click a.js-toggle-vote-public'(event) {
event.preventDefault();
@ -1218,7 +1218,7 @@ BlazeComponent.extendComponent({
// if active vote - store it
if (this.currentData().getVoteQuestion()) {
this._storeDate(newDate.toDate());
Popup.close();
Popup.back();
} else {
this.currentData().vote = { end: newDate.toDate() }; // set vote end temp
Popup.back();
@ -1252,86 +1252,77 @@ BlazeComponent.extendComponent({
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(usaDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: usaDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (euroAmDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(euroAmDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: euroAmDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (euro24hDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(euro24hDate.toDate());
this.card.setPokerEnd(euro24hDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: euro24hDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (eurodotDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(eurodotDate.toDate());
this.card.setPokerEnd(eurodotDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: eurodotDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (minusDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(minusDate.toDate());
this.card.setPokerEnd(minusDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: minusDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (slashDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(slashDate.toDate());
this.card.setPokerEnd(slashDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: slashDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (dotDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(dotDate.toDate());
this.card.setPokerEnd(dotDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: dotDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (brezhonegDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(brezhonegDate.toDate());
this.card.setPokerEnd(brezhonegDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: brezhonegDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (hrvatskiDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(hrvatskiDate.toDate());
this.card.setPokerEnd(hrvatskiDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: hrvatskiDate.toDate() }; // set poker end temp
Popup.back();
@ -1341,41 +1332,37 @@ BlazeComponent.extendComponent({
if (this.currentData().getPokerQuestion()) {
this._storeDate(latviaDate.toDate());
this.card.setPokerEnd(latviaDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: latviaDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (nederlandsDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(nederlandsDate.toDate());
this.card.setPokerEnd(nederlandsDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: nederlandsDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (greekDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(greekDate.toDate());
this.card.setPokerEnd(greekDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: greekDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (macedonianDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(macedonianDate.toDate());
this.card.setPokerEnd(macedonianDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: macedonianDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else {
this.error.set('invalid-date');
evt.target.date.focus();
@ -1384,7 +1371,7 @@ BlazeComponent.extendComponent({
'click .js-delete-date'(evt) {
evt.preventDefault();
this._deleteDate();
Popup.close();
Popup.back();
},
},
];
@ -1422,11 +1409,11 @@ BlazeComponent.extendComponent({
if (endString) {
this.currentCard.setPokerEnd(endString);
}
Popup.close();
Popup.back();
},
'click .js-remove-poker': Popup.afterConfirm('deletePoker', (event) => {
this.currentCard.unsetPoker();
Popup.close();
Popup.back();
}),
'click a.js-toggle-poker-allow-non-members'(event) {
event.preventDefault();
@ -1489,7 +1476,7 @@ BlazeComponent.extendComponent({
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(newDate.toDate());
Popup.close();
Popup.back();
} else {
this.currentData().poker = { end: newDate.toDate() }; // set poker end temp
Popup.back();
@ -1521,130 +1508,117 @@ BlazeComponent.extendComponent({
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(usaDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: usaDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (euroAmDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(euroAmDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: euroAmDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (euro24hDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(euro24hDate.toDate());
this.card.setPokerEnd(euro24hDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: euro24hDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (eurodotDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(eurodotDate.toDate());
this.card.setPokerEnd(eurodotDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: eurodotDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (minusDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(minusDate.toDate());
this.card.setPokerEnd(minusDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: minusDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (slashDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(slashDate.toDate());
this.card.setPokerEnd(slashDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: slashDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (dotDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(dotDate.toDate());
this.card.setPokerEnd(dotDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: dotDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (brezhonegDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(brezhonegDate.toDate());
this.card.setPokerEnd(brezhonegDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: brezhonegDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (hrvatskiDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(hrvatskiDate.toDate());
this.card.setPokerEnd(hrvatskiDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: hrvatskiDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (latviaDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(latviaDate.toDate());
this.card.setPokerEnd(latviaDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: latviaDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (nederlandsDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(nederlandsDate.toDate());
this.card.setPokerEnd(nederlandsDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: nederlandsDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (greekDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(greekDate.toDate());
this.card.setPokerEnd(greekDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: greekDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else if (macedonianDate.isValid()) {
// if active poker - store it
if (this.currentData().getPokerQuestion()) {
this._storeDate(macedonianDate.toDate());
this.card.setPokerEnd(macedonianDate.toDate());
Popup.close();
} else {
this.currentData().poker = { end: macedonianDate.toDate() }; // set poker end temp
Popup.back();
}
Popup.back();
} else {
// this.error.set('invalid-date);
this.error.set('invalid-date' + ' ' + dateString);
@ -1654,7 +1628,7 @@ BlazeComponent.extendComponent({
'click .js-delete-date'(evt) {
evt.preventDefault();
this._deleteDate();
Popup.close();
Popup.back();
},
},
];
@ -1781,7 +1755,7 @@ Template.cardAssigneePopup.helpers({
Template.cardAssigneePopup.events({
'click .js-remove-assignee'() {
Cards.findOne(this.cardId).unassignAssignee(this.userId);
Popup.close();
Popup.back();
},
'click .js-edit-profile': Popup.open('editProfile'),
});

View file

@ -34,7 +34,7 @@ BlazeComponent.extendComponent({
}
if (spentTime >= 0) {
this.storeTime(spentTime, isOvertime);
Popup.close();
Popup.back();
} else {
this.error.set('invalid-time');
evt.target.time.focus();
@ -43,7 +43,7 @@ BlazeComponent.extendComponent({
'click .js-delete-time'(evt) {
evt.preventDefault();
this.deleteTime();
Popup.close();
Popup.back();
},
'click a.js-toggle-overtime': this.toggleOvertime,
},

View file

@ -187,7 +187,7 @@ window.ExportHtml = Popup => {
const boardSlug = getBoardSlug();
await addJsonExportToZip(zip, boardSlug);
Popup.close();
Popup.back();
closeSidebar();
cleanBoardHtml();