mirror of
https://github.com/wekan/wekan.git
synced 2025-12-24 19:30:12 +01:00
31 lines
550 B
JavaScript
31 lines
550 B
JavaScript
const closedValue = null
|
|
|
|
window.Modal = new class {
|
|
constructor() {
|
|
this._currentModal = new ReactiveVar(closedValue)
|
|
}
|
|
|
|
getTemplateName() {
|
|
return this._currentModal.get()
|
|
}
|
|
|
|
isOpen() {
|
|
return this.getTemplateName() !== closedValue
|
|
}
|
|
|
|
close() {
|
|
this._currentModal.set(closedValue)
|
|
}
|
|
|
|
open(modalName) {
|
|
this._currentModal.set(modalName)
|
|
}
|
|
};
|
|
|
|
Blaze.registerHelper('Modal', Modal)
|
|
|
|
EscapeActions.register('modalWindow',
|
|
() => Modal.close(),
|
|
() => Modal.isOpen(),
|
|
{ noClickEscapeOn: '.modal-content' }
|
|
);
|