summaryrefslogtreecommitdiffstats
path: root/client/lib/modal.js
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-08-27 00:27:23 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-08-28 00:39:18 +0200
commit31c4aa01bda63e510e120ae9da8149c732111d2a (patch)
tree9d567a379c75f9f7feb9c687108ce53841a5399c /client/lib/modal.js
parent95dcd8a146d5fa8ef0957019faf59fbfdcf98788 (diff)
downloadwekan-31c4aa01bda63e510e120ae9da8149c732111d2a.tar.gz
wekan-31c4aa01bda63e510e120ae9da8149c732111d2a.tar.bz2
wekan-31c4aa01bda63e510e120ae9da8149c732111d2a.zip
Open a modal (or a new page) based on context
This feature is also sometime named the Pinterest-style route, which is further explained in this react-router example: https://github.com/rackt/react-router/tree/cf0419f70e14a0ae39cba2ff99b01d3cbbd085be/examples/pinterest
Diffstat (limited to 'client/lib/modal.js')
-rw-r--r--client/lib/modal.js19
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(),