summaryrefslogtreecommitdiff
path: root/assets/js/src
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-16 23:28:02 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-16 23:28:02 -0500
commit2c68efac3ae754c0d8162bf59eb1be30e1188902 (patch)
tree0c9a40d74e36eee98bf732667a2d4cf83cbd27da /assets/js/src
parent0db66953a78b704e3710b970ab11b87058bb3859 (diff)
Add chosen multiple select for due date and recent filters
Diffstat (limited to 'assets/js/src')
-rw-r--r--assets/js/src/board.js32
1 files changed, 9 insertions, 23 deletions
diff --git a/assets/js/src/board.js b/assets/js/src/board.js
index cd1e0361..cd83fea3 100644
--- a/assets/js/src/board.js
+++ b/assets/js/src/board.js
@@ -272,8 +272,8 @@ Kanboard.Board = (function() {
{
var selectedUserId = $("#form-user_id").val();
var selectedCategoryId = $("#form-category_id").val();
- var filterDueDate = $("#filter-due-date").hasClass("filter-on");
- var filterRecent = $("#filter-recent").hasClass("filter-on");
+ var filterDueDate = $("#more-filters option[value=filter-due-date]").is(":selected")
+ var filterRecent = $("#more-filters option[value=filter-recent]").is(":selected")
var projectId = $('#board').data('project-id');
$("[data-task-id]").each(function(index, item) {
@@ -319,28 +319,16 @@ Kanboard.Board = (function() {
width: "180px"
});
- $("#form-user_id").change(function(e) {
- filter_apply();
- });
-
$("#form-category_id").chosen({
width: "200px"
});
- $("#form-category_id").change(function(e) {
- filter_apply();
- });
-
- $("#filter-due-date").click(function(e) {
- $(this).toggleClass("filter-on");
- filter_apply();
- e.preventDefault();
+ $("#more-filters").chosen({
+ width: "30%"
});
- $("#filter-recent").click(function(e) {
- $(this).toggleClass("filter-on");
+ $(".apply-filters").change(function(e) {
filter_apply();
- e.preventDefault();
});
// Get and set filters from localStorage
@@ -351,17 +339,15 @@ Kanboard.Board = (function() {
$("#form-category_id").trigger("chosen:updated");
if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) {
- $("#filter-due-date").addClass("filter-on");
- } else {
- $("#filter-due-date").removeClass("filter-on");
+ $("#more-filters option[value=filter-due-date]").attr("selected", true);
}
if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-recent")) {
- $("#filter-recent").addClass("filter-on");
- } else {
- $("#filter-recent").removeClass("filter-on");
+ $("#more-filters option[value=filter-recent]").attr("selected", true);
}
+ $("#more-filters").trigger("chosen:updated");
+
filter_apply();
}