Add prefix for local storage keys
This commit is contained in:
@@ -394,6 +394,14 @@ Kanboard.Board = (function() {
|
|||||||
item.style.opacity = "0.2";
|
item.style.opacity = "0.2";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load filter events
|
// Load filter events
|
||||||
@@ -408,6 +416,22 @@ Kanboard.Board = (function() {
|
|||||||
filter_apply();
|
filter_apply();
|
||||||
e.preventDefault();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -214,12 +214,12 @@ Kanboard.Board = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Save filter settings for active project to localStorage
|
// Save filter settings for active project to localStorage
|
||||||
if (typeof(Storage) !== "undefined") {
|
if (typeof(Storage) !== "undefined") {
|
||||||
var projectId = $('#board').data('project-id');
|
var projectId = $('#board').data('project-id');
|
||||||
localStorage.setItem(projectId + "_form-user_id", selectedUserId);
|
localStorage.setItem("filters_" + projectId + "_form-user_id", selectedUserId);
|
||||||
localStorage.setItem(projectId + "_form-category_id", selectedCategoryId);
|
localStorage.setItem("filters_" + projectId + "_form-category_id", selectedCategoryId);
|
||||||
localStorage.setItem(projectId + "_filter-due-date", ~~(filterDueDate));
|
localStorage.setItem("filters_" + projectId + "_filter-due-date", ~~(filterDueDate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,16 +239,16 @@ Kanboard.Board = (function() {
|
|||||||
// Get and set filters from localStorage for active project
|
// Get and set filters from localStorage for active project
|
||||||
if (typeof(Storage) !== "undefined") {
|
if (typeof(Storage) !== "undefined") {
|
||||||
var projectId = $('#board').data('project-id');
|
var projectId = $('#board').data('project-id');
|
||||||
$("#form-user_id").val(localStorage.getItem(projectId + "_form-user_id") || -1);
|
|
||||||
$("#form-category_id").val(localStorage.getItem(projectId + "_form-category_id") || -1);
|
$("#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(projectId + "_filter-due-date")) {
|
if (+localStorage.getItem("filters_" + projectId + "_filter-due-date")) {
|
||||||
$("#filter-due-date").addClass("filter-on");
|
$("#filter-due-date").addClass("filter-on");
|
||||||
} else {
|
} else {
|
||||||
$("#filter-due-date").removeClass("filter-on");
|
$("#filter-due-date").removeClass("filter-on");
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply filters on load
|
|
||||||
filter_apply();
|
filter_apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user