summaryrefslogtreecommitdiffstats
path: root/client/components/forms
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-06-07 10:30:27 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-06-07 10:34:19 +0200
commit92dd05d06ddeb2a9434df6038c432e6b167c1c99 (patch)
treeecb93138c1dd0ab0c1fcf2682a6eae600a4bbca9 /client/components/forms
parent12919cbfc6c3fd0793624776b3afb70e3a0cdd1a (diff)
downloadwekan-92dd05d06ddeb2a9434df6038c432e6b167c1c99.tar.gz
wekan-92dd05d06ddeb2a9434df6038c432e6b167c1c99.tar.bz2
wekan-92dd05d06ddeb2a9434df6038c432e6b167c1c99.zip
Click on the page to escape the last action
This is a generalization of what we had for closing a popup by clicking outside of it. It now works for inlinedForms and detailsPane as well.
Diffstat (limited to 'client/components/forms')
-rw-r--r--client/components/forms/inlinedform.jade2
-rw-r--r--client/components/forms/inlinedform.js18
2 files changed, 5 insertions, 15 deletions
diff --git a/client/components/forms/inlinedform.jade b/client/components/forms/inlinedform.jade
index 5ad9039e..40e1c35c 100644
--- a/client/components/forms/inlinedform.jade
+++ b/client/components/forms/inlinedform.jade
@@ -1,6 +1,6 @@
template(name='inlinedForm')
if isOpen.get
- form(id=id class=classNames)
+ form.js-inlined-form(id=id class=classNames)
+Template.contentBlock
else
+Template.elseBlock
diff --git a/client/components/forms/inlinedform.js b/client/components/forms/inlinedform.js
index e4331892..2988738c 100644
--- a/client/components/forms/inlinedform.js
+++ b/client/components/forms/inlinedform.js
@@ -36,7 +36,7 @@ BlazeComponent.extendComponent({
open: function() {
// Close currently opened form, if any
- EscapeActions.executeLowerThan('inlinedForm');
+ EscapeActions.executeUpTo('inlinedForm');
this.isOpen.set(true);
currentlyOpenedForm.set(this);
},
@@ -61,18 +61,6 @@ BlazeComponent.extendComponent({
'click .js-close-inlined-form': this.close,
'click .js-open-inlined-form': this.open,
- // Close the inlined form by pressing escape.
- //
- // Keydown (and not keypress) in necessary here because the `keyCode`
- // property is consistent in all browsers, (there is not keyCode for the
- // `keypress` event in firefox)
- 'keydown form input, keydown form textarea': function(evt) {
- if (evt.keyCode === 27) {
- evt.preventDefault();
- EscapeActions.executeLowest();
- }
- },
-
// Pressing Ctrl+Enter should submit the form
'keydown form textarea': function(evt) {
if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
@@ -98,5 +86,7 @@ BlazeComponent.extendComponent({
// Press escape to close the currently opened inlinedForm
EscapeActions.register('inlinedForm',
function() { currentlyOpenedForm.get().close(); },
- function() { return currentlyOpenedForm.get() !== null; }
+ function() { return currentlyOpenedForm.get() !== null; }, {
+ noClickEscapeOn: '.js-inlined-form'
+ }
);