diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-01-17 17:11:51 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-01-17 17:11:51 -0500 |
commit | 84b0f0df90442775b9122457648f06c9485df1f1 (patch) | |
tree | 5f0fb91ed9280bbf10bb60d69f3523cafc928f5c /assets/js/board.js | |
parent | 4b45b2aa3533309898670f1b13756dfdfce355a7 (diff) |
Add project calendars (merge/refactoring of #490)
Diffstat (limited to 'assets/js/board.js')
-rw-r--r-- | assets/js/board.js | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/assets/js/board.js b/assets/js/board.js index 8545df1f..98365486 100644 --- a/assets/js/board.js +++ b/assets/js/board.js @@ -1,4 +1,3 @@ -// Board related functions Kanboard.Board = (function() { var checkInterval = null; @@ -191,6 +190,7 @@ Kanboard.Board = (function() { var selectedUserId = $("#form-user_id").val(); var selectedCategoryId = $("#form-category_id").val(); var filterDueDate = $("#filter-due-date").hasClass("filter-on"); + var projectId = $('#board').data('project-id'); $("[data-task-id]").each(function(index, item) { @@ -214,43 +214,36 @@ Kanboard.Board = (function() { } }); - // Save filter settings for active project to localStorage - if (typeof(Storage) !== "undefined") { - var projectId = $('#board').data('project-id'); - localStorage.setItem("filters_" + projectId + "_form-user_id", selectedUserId); - localStorage.setItem("filters_" + projectId + "_form-category_id", selectedCategoryId); - localStorage.setItem("filters_" + projectId + "_filter-due-date", ~~(filterDueDate)); - } + // 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)); } // Load filter events function filter_load_events() { - $("#form-user_id").change(filter_apply); + var projectId = $('#board').data('project-id'); + $("#form-user_id").change(filter_apply); $("#form-category_id").change(filter_apply); - $("#filter-due-date").click(function(e) { $(this).toggleClass("filter-on"); filter_apply(); e.preventDefault(); }); - // Get and set filters from localStorage for active project - if (typeof(Storage) !== "undefined") { - var projectId = $('#board').data('project-id'); - - $("#form-user_id").val(localStorage.getItem("filters_" + projectId + "_form-user_id") || -1); - $("#form-category_id").val(localStorage.getItem("filters_" + projectId + "_form-category_id") || -1); - - if (+localStorage.getItem("filters_" + projectId + "_filter-due-date")) { - $("#filter-due-date").addClass("filter-on"); - } else { - $("#filter-due-date").removeClass("filter-on"); - } - - filter_apply(); + // Get and set filters from localStorage + $("#form-user_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-user_id") || -1); + $("#form-category_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-category_id") || -1); + + if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) { + $("#filter-due-date").addClass("filter-on"); + } else { + $("#filter-due-date").removeClass("filter-on"); } + + filter_apply(); } return { |