diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-08-23 11:04:35 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-08-23 11:12:04 +0200 |
commit | d2af2ed521eb283ef7499789f23cccc4308812fa (patch) | |
tree | 83dea87a338f4b6b4ccc6e7683d925a4653440d9 /client/lib/popup.js | |
parent | 2248671b7c022f889584e0931948fe5fbe4f54a6 (diff) | |
download | wekan-d2af2ed521eb283ef7499789f23cccc4308812fa.tar.gz wekan-d2af2ed521eb283ef7499789f23cccc4308812fa.tar.bz2 wekan-d2af2ed521eb283ef7499789f23cccc4308812fa.zip |
Close the Popup when all escape actions are executed
Diffstat (limited to 'client/lib/popup.js')
-rw-r--r-- | client/lib/popup.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/client/lib/popup.js b/client/lib/popup.js index 84d4b63a..6435eac6 100644 --- a/client/lib/popup.js +++ b/client/lib/popup.js @@ -194,9 +194,14 @@ Popup = { // We close a potential opened popup on any left click on the document, or go // one step back by pressing escape. -EscapeActions.register('popup', - function(evt) { Popup[evt.type === 'click' ? 'close' : 'back'](); }, - _.bind(Popup.isOpen, Popup), { - noClickEscapeOn: '.js-pop-over' - } -); +var escapeActions = ['back', 'close']; +_.each(escapeActions, function(actionName) { + EscapeActions.register('popup-' + actionName, + _.bind(Popup[actionName], Popup), + _.bind(Popup.isOpen, Popup), { + noClickEscapeOn: '.js-pop-over', + enabledOnClick: actionName === 'close' + } + ); +}); + |