From 36bdcf193b6d54eefe27f58689c44953715a4dad Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 24 Apr 2016 18:07:05 -0400 Subject: Category and user filters do not append anymore in search field --- assets/js/src/Search.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'assets/js/src') 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; } -- cgit v1.2.3