diff options
Diffstat (limited to 'client/lib/modal.js')
-rw-r--r-- | client/lib/modal.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/client/lib/modal.js b/client/lib/modal.js index 492f6595..9b204bb4 100644 --- a/client/lib/modal.js +++ b/client/lib/modal.js @@ -2,27 +2,32 @@ const closedValue = null window.Modal = new class { constructor() { - this._currentModal = new ReactiveVar(closedValue) + this._currentModal = new ReactiveVar(closedValue); + this._onCloseGoTo = ''; } getTemplateName() { - return this._currentModal.get() + return this._currentModal.get(); } isOpen() { - return this.getTemplateName() !== closedValue + return this.getTemplateName() !== closedValue; } close() { - this._currentModal.set(closedValue) + this._currentModal.set(closedValue); + if (this._onCloseGoTo) { + FlowRouter.go(this._onCloseGoTo); + } } - open(modalName) { - this._currentModal.set(modalName) + open(modalName, options) { + this._currentModal.set(modalName); + this._onCloseGoTo = options && options.onCloseGoTo || ''; } }; -Blaze.registerHelper('Modal', Modal) +Blaze.registerHelper('Modal', Modal); EscapeActions.register('modalWindow', () => Modal.close(), |