diff options
author | Imbasaur <yarrusg@gmail.com> | 2016-04-29 15:20:48 +0200 |
---|---|---|
committer | Imbasaur <yarrusg@gmail.com> | 2016-04-29 15:20:48 +0200 |
commit | 7459bc1c40af72441ccdaff944ef2dc9465ba9bf (patch) | |
tree | fea088cdda93079aee9e719a1bbe8464358efbb0 /assets/js/src | |
parent | 99f275e5bb033cca33eee87b0e914645730f13d1 (diff) | |
parent | 81a25cbe6328eab7c4de0befc64186610ecc7f49 (diff) |
Merge pull request #2 from fguillot/master
merge
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/App.js | 12 | ||||
-rw-r--r-- | assets/js/src/Bootstrap.js (renamed from assets/js/src/bootstrap.js) | 0 | ||||
-rw-r--r-- | assets/js/src/Popover.js | 10 | ||||
-rw-r--r-- | assets/js/src/Search.js | 10 |
4 files changed, 25 insertions, 7 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/bootstrap.js b/assets/js/src/Bootstrap.js index d5f3c7ef..d5f3c7ef 100644 --- a/assets/js/src/bootstrap.js +++ b/assets/js/src/Bootstrap.js 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) { diff --git a/assets/js/src/Search.js b/assets/js/src/Search.js index ce753246..f6409f54 100644 --- a/assets/js/src/Search.js +++ b/assets/js/src/Search.js @@ -16,15 +16,21 @@ Kanboard.Search.prototype.focus = function() { }; Kanboard.Search.prototype.listen = function() { - // Filter helper for search $(document).on("click", ".filter-helper", function (e) { e.preventDefault(); var filter = $(this).data("filter"); var appendFilter = $(this).data("append-filter"); + var uniqueFilter = $(this).data("unique-filter"); var input = $("#form-search"); - if (appendFilter) { + if (uniqueFilter) { + var attribute = uniqueFilter.substr(0, uniqueFilter.indexOf(':')); + filter = input.val().replace(new RegExp('(' + attribute + ':[#a-z0-9]+)', 'g'), ''); + filter = filter.replace(new RegExp('(' + attribute + ':"(.+)")', 'g'), ''); + filter = filter.trim(); + filter += ' ' + uniqueFilter; + } else if (appendFilter) { filter = input.val() + " " + appendFilter; } |