Add users and categories filters on the board

This commit is contained in:
Frederic Guillot
2015-08-21 21:49:53 -04:00
parent 0057400d73
commit 7b664afd61
8 changed files with 88 additions and 5 deletions

View File

@@ -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);

View File

@@ -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()) {

View File

@@ -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();
}
});
};