Fix Popup.afterCommit

We need to use "function() {}" instead of the ES6 style "() {}" with
popup.afterCommit because we need the original value of "this" inside
the callback.
This commit is contained in:
Alexander Sulfrian 2015-09-20 15:55:23 +02:00
parent ec92f84f41
commit f4a68a0f7d
4 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ Template.boardMenuPopup.events({
}, },
'click .js-change-board-color': Popup.open('boardChangeColor'), 'click .js-change-board-color': Popup.open('boardChangeColor'),
'click .js-change-language': Popup.open('changeLanguage'), 'click .js-change-language': Popup.open('changeLanguage'),
'click .js-archive-board ': Popup.afterConfirm('archiveBoard', () => { 'click .js-archive-board ': Popup.afterConfirm('archiveBoard', function() {
const currentBoard = Boards.findOne(Session.get('currentBoard')); const currentBoard = Boards.findOne(Session.get('currentBoard'));
currentBoard.archive(); currentBoard.archive();
// XXX We should have some kind of notification on top of the page to // XXX We should have some kind of notification on top of the page to

View file

@ -1,7 +1,7 @@
Template.attachmentsGalery.events({ Template.attachmentsGalery.events({
'click .js-add-attachment': Popup.open('cardAttachments'), 'click .js-add-attachment': Popup.open('cardAttachments'),
'click .js-confirm-delete': Popup.afterConfirm('attachmentDelete', 'click .js-confirm-delete': Popup.afterConfirm('attachmentDelete',
() => { function() {
Attachments.remove(this._id); Attachments.remove(this._id);
Popup.close(); Popup.close();
} }

View file

@ -152,10 +152,10 @@ Template.moveCardPopup.events({
}); });
Template.cardMorePopup.events({ Template.cardMorePopup.events({
'click .js-delete': Popup.afterConfirm('cardDelete', () => { 'click .js-delete': Popup.afterConfirm('cardDelete', function() {
Popup.close(); Popup.close();
Cards.remove(this._id); Cards.remove(this._id);
Utils.goBoardId(this.board()._id); Utils.goBoardId(this.boardId);
}), }),
}); });

View file

@ -34,7 +34,7 @@ Template.listActionPopup.events({
Popup.close(); Popup.close();
}, },
'click .js-move-cards': Popup.open('listMoveCards'), 'click .js-move-cards': Popup.open('listMoveCards'),
'click .js-archive-cards': Popup.afterConfirm('listArchiveCards', () => { 'click .js-archive-cards': Popup.afterConfirm('listArchiveCards', function() {
this.allCards().forEach((card) => { this.allCards().forEach((card) => {
card.archive(); card.archive();
}); });