diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-07-04 11:14:21 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-07-04 11:14:21 -0400 |
commit | 554500aa493faa66b43b2ddce72338880a874724 (patch) | |
tree | 73066cfbe6af3cabf81b5be1dc5ef81e44792a21 /assets/js/src/board.js | |
parent | a327f790ee036664439bf50e00c95fb8a0e1f97e (diff) |
Refactoring to implement new layout with filters: board/calendar/list views (work in progress)
Diffstat (limited to 'assets/js/src/board.js')
-rw-r--r-- | assets/js/src/board.js | 92 |
1 files changed, 1 insertions, 91 deletions
diff --git a/assets/js/src/board.js b/assets/js/src/board.js index 9f93a869..d11e39f5 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -1,4 +1,4 @@ -Kanboard.Board = (function() { +(function() { var checkInterval = null; @@ -243,7 +243,6 @@ Kanboard.Board = (function() { $("#main").append(data); Kanboard.InitAfterAjax(); board_load_events(); - filter_apply(); stack_show(); compactview_reload(); } @@ -264,7 +263,6 @@ Kanboard.Board = (function() { Kanboard.InitAfterAjax(); board_unload_events(); board_load_events(); - filter_apply(); stack_show(); compactview_reload(); } @@ -273,93 +271,6 @@ Kanboard.Board = (function() { } } - // Apply user or date filter (change tasks opacity) - function filter_apply() - { - var selectedUserId = $("#form-user_id").val(); - var selectedCategoryId = $("#form-category_id").val(); - 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) { - - var ownerId = item.getAttribute("data-owner-id"); - var dueDate = item.getAttribute("data-due-date"); - var categoryId = item.getAttribute("data-category-id"); - var recent = $(item).hasClass("task-board-recent"); - - if (ownerId != selectedUserId && selectedUserId != -1) { - item.style.display = "none"; - } - else { - item.style.display = "block"; - } - - if (filterDueDate && (dueDate == "" || dueDate == "0")) { - item.style.display = "none"; - } - - if (categoryId != selectedCategoryId && selectedCategoryId != -1) { - item.style.display = "none"; - } - - if (filterRecent && ! recent) { - item.style.display = "none"; - } - }); - - // Save filter settings - Kanboard.SetStorageItem("board_filter_" + projectId + "_form-user_id", selectedUserId); - Kanboard.SetStorageItem("board_filter_" + projectId + "_form-category_id", selectedCategoryId); - Kanboard.SetStorageItem("board_filter_" + projectId + "_filter-due-date", ~~(filterDueDate)); - Kanboard.SetStorageItem("board_filter_" + projectId + "_filter-recent", ~~(filterRecent)); - } - - // Load filter events - function filter_load_events() - { - var projectId = $('#board').data('project-id'); - - $("#form-user_id").chosen({ - width: "180px", - no_results_text: $("#form-user_id").data("notfound") - }); - - $("#form-category_id").chosen({ - width: "200px", - no_results_text: $("#form-category_id").data("notfound") - }); - - $("#more-filters").chosen({ - width: "30%", - no_results_text: $("#more-filters").data("notfound") - }); - - $(".apply-filters").change(function(e) { - filter_apply(); - }); - - // Get and set filters from localStorage - $("#form-user_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-user_id") || -1); - $("#form-user_id").trigger("chosen:updated"); - - $("#form-category_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-category_id") || -1); - $("#form-category_id").trigger("chosen:updated"); - - if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) { - $("#more-filters option[value=filter-due-date]").attr("selected", true); - } - - if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-recent")) { - $("#more-filters option[value=filter-recent]").attr("selected", true); - } - - $("#more-filters").trigger("chosen:updated"); - - filter_apply(); - } - function compactview_load_events() { jQuery(document).on('click', ".filter-toggle-scrolling", function(e) { @@ -401,7 +312,6 @@ Kanboard.Board = (function() { if (Kanboard.Exists("board")) { board_load_events(); - filter_load_events(); stack_load_events(); compactview_load_events(); keyboard_shortcuts(); |