Move Display-like settings into Display panel, add input for grid locator and (not yet implemented) toggles for columns. #19

This commit is contained in:
Ian Renton
2025-10-12 10:06:09 +01:00
parent 3500ec7e03
commit b61f08768c
8 changed files with 260 additions and 68 deletions

View File

@@ -34,7 +34,7 @@ function generateMultiToggleFilterCard(displayName, filterQuery, options) {
let $card = $("<div class='card'>");
let $card_body = $("<div class='card-body'>");
$card_body.append(`<h5 class='card-title'>${displayName}</h5>`);
$p = $("<p class='card-text filter-card-text'>");
$p = $("<p class='card-text spothole-card-text'>");
// Create a button for each option
options.forEach(o => {
$p.append(`<input type="checkbox" class="btn-check filter-button-${filterQuery} storeable-checkbox" name="options" id="filter-button-${filterQuery}-${o}" value="${o}" autocomplete="off" onClick="filtersUpdated()" checked><label class="btn btn-outline-primary" for="filter-button-${filterQuery}-${o}">${o}</label> `);
@@ -98,7 +98,7 @@ function escapeHtml(str) {
}
// When the "use local time" field is changed, reload the table and save settings
function localTimeUpdated() {
function timeZoneUpdated() {
updateTable();
saveSettings();
}
@@ -108,10 +108,13 @@ function saveSettings() {
// Find all storeable UI elements, store a key of "element id:property name" mapped to the value of that
// property. For a checkbox, that's the "checked" property.
$(".storeable-checkbox").each(function() {
localStorage.setItem("#" + $(this)[0].id + ":checked", $(this)[0].checked);
localStorage.setItem("#" + $(this)[0].id + ":checked", JSON.stringify($(this)[0].checked));
});
$(".storeable-select").each(function() {
localStorage.setItem("#" + $(this)[0].id + ":value", $(this)[0].value);
localStorage.setItem("#" + $(this)[0].id + ":value", JSON.stringify($(this)[0].value));
});
$(".storeable-text").each(function() {
localStorage.setItem("#" + $(this)[0].id + ":value", JSON.stringify($(this)[0].value));
});
}