summaryrefslogtreecommitdiff
path: root/assets/js/src
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-08-21 21:49:53 -0400
committerFrederic Guillot <fred@kanboard.net>2015-08-21 21:49:53 -0400
commit7b664afd61703ad29af0938131209debd25bdf40 (patch)
tree2a571f3f91cd17ead788096b93a37dbf37fbefac /assets/js/src
parent0057400d73eb698d9de396ae509bae7bf31acff2 (diff)
Add users and categories filters on the board
Diffstat (limited to 'assets/js/src')
-rw-r--r--assets/js/src/App.js3
-rw-r--r--assets/js/src/Board.js17
-rw-r--r--assets/js/src/Search.js17
3 files changed, 33 insertions, 4 deletions
diff --git a/assets/js/src/App.js b/assets/js/src/App.js
index b0c1712e..2872baf6 100644
--- a/assets/js/src/App.js
+++ b/assets/js/src/App.js
@@ -1,7 +1,8 @@
function App() {
+ this.board = new Board(this);
this.markdown = new Markdown();
this.sidebar = new Sidebar();
- this.search = new Search();
+ this.search = new Search(this);
this.swimlane = new Swimlane();
this.dropdown = new Dropdown();
this.tooltip = new Tooltip(this);
diff --git a/assets/js/src/Board.js b/assets/js/src/Board.js
index 48bbdacb..edf041f6 100644
--- a/assets/js/src/Board.js
+++ b/assets/js/src/Board.js
@@ -25,6 +25,23 @@ Board.prototype.poll = function() {
}
};
+Board.prototype.reloadFilters = function(search) {
+ this.app.showLoadingIcon();
+
+ $.ajax({
+ cache: false,
+ url: $("#board").data("reload-url"),
+ contentType: "application/json",
+ type: "POST",
+ processData: false,
+ data: JSON.stringify({
+ search: search
+ }),
+ success: this.refresh.bind(this),
+ error: this.app.hideLoadingIcon.bind(this)
+ });
+};
+
Board.prototype.check = function() {
if (this.app.isVisible()) {
diff --git a/assets/js/src/Search.js b/assets/js/src/Search.js
index d38ffd2b..b35c4b67 100644
--- a/assets/js/src/Search.js
+++ b/assets/js/src/Search.js
@@ -1,4 +1,5 @@
-function Search() {
+function Search(app) {
+ this.app = app;
this.keyboardShortcuts();
}
@@ -12,11 +13,21 @@ Search.prototype.focus = function() {
};
Search.prototype.listen = function() {
+ var self = this;
+
// Filter helper for search
$(document).on("click", ".filter-helper", function (e) {
e.preventDefault();
- $("#form-search").val($(this).data("filter"));
- $("form.search").submit();
+ var filter = $(this).data("filter");
+
+ $("#form-search").val(filter);
+
+ if ($('#board').length) {
+ self.app.board.reloadFilters(filter);
+ }
+ else {
+ $("form.search").submit();
+ }
});
};