summaryrefslogtreecommitdiff
path: root/assets/js/src
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-04-13 18:24:36 -0400
committerFrederic Guillot <fred@kanboard.net>2016-04-13 18:24:36 -0400
commitab02a9a162e5a58bd92e7bb44636f683ce2ec730 (patch)
treee8c23bd7d875175e96cc3f77751159bb32ca3a04 /assets/js/src
parent2a574c408eda5694898be9407c54fabc1d55905b (diff)
Fixed form submission with Meta+Enter keyboard shortcut
Diffstat (limited to 'assets/js/src')
-rw-r--r--assets/js/src/App.js12
-rw-r--r--assets/js/src/Popover.js10
2 files changed, 17 insertions, 5 deletions
diff --git a/assets/js/src/App.js b/assets/js/src/App.js
index 62e091fc..3fe75640 100644
--- a/assets/js/src/App.js
+++ b/assets/js/src/App.js
@@ -42,7 +42,17 @@ Kanboard.App.prototype.keyboardShortcuts = function() {
// Submit form
Mousetrap.bindGlobal("mod+enter", function() {
- $("form").submit();
+ var forms = $("form");
+
+ if (forms.length == 1) {
+ forms.submit();
+ } else if (forms.length > 1) {
+ if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') {
+ $(document.activeElement).parents("form").submit();
+ } else if (self.get("Popover").isOpen()) {
+ $("#popover-container form").submit();
+ }
+ }
});
// Open board selector
diff --git a/assets/js/src/Popover.js b/assets/js/src/Popover.js
index 705a035a..216d6bf5 100644
--- a/assets/js/src/Popover.js
+++ b/assets/js/src/Popover.js
@@ -45,10 +45,12 @@ Kanboard.Popover.prototype.isOpen = function() {
Kanboard.Popover.prototype.open = function(link) {
var self = this;
- $.get(link, function(content) {
- $("body").prepend('<div id="popover-container"><div id="popover-content">' + content + '</div></div>');
- self.executeOnOpenedListeners();
- });
+ if (!self.isOpen()) {
+ $.get(link, function(content) {
+ $("body").prepend('<div id="popover-container"><div id="popover-content">' + content + '</div></div>');
+ self.executeOnOpenedListeners();
+ });
+ }
};
Kanboard.Popover.prototype.close = function(e) {