mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 16:00:13 +01:00
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:
cf0419f70e/examples/pinterest
This commit is contained in:
parent
95dcd8a146
commit
31c4aa01bd
6 changed files with 57 additions and 24 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue