diff --git a/server/webserver.py b/server/webserver.py index be56de1..ceb35f7 100644 --- a/server/webserver.py +++ b/server/webserver.py @@ -32,7 +32,7 @@ class WebServer: bottle.get("/api/status")(lambda: self.serve_api(self.status_data)) bottle.post("/api/spot")(lambda: self.accept_spot()) # Routes for templated pages - bottle.get("/")(lambda: self.serve_template('webpage_home')) + bottle.get("/")(lambda: self.serve_template('webpage_spots')) bottle.get("/about")(lambda: self.serve_template('webpage_about')) bottle.get("/apidocs")(lambda: self.serve_template('webpage_apidocs')) # Default route to serve from "webassets" diff --git a/views/webpage_home.tpl b/views/webpage_spots.tpl similarity index 90% rename from views/webpage_home.tpl rename to views/webpage_spots.tpl index f5b3968..d923ee1 100644 --- a/views/webpage_home.tpl +++ b/views/webpage_spots.tpl @@ -53,11 +53,6 @@
- - -
"); + // Create a button for each option options.forEach(o => { $p.append(` `); }); + // Create All/None buttons + $p.append(` `); + // Compile HTML elements to return $card_body.append($p); $card.append($card_body); $col.append($card); @@ -272,18 +276,30 @@ function generateBandsFilterCard(displayName, filterQuery, band_options) { let $card_body = $("
"); + // Create a button for each option band_options.forEach(o => { // CSS doesn't like IDs with decimal points in, so we need to replace that in the same way as when we originally // queried the options endpoint and set our CSS. var cssFormattedBandName = o['name'] ? o['name'].replace('.', 'p') : "unknown"; $p.append(` `); }); + // Create All/None buttons + $p.append(` `); + // Compile HTML elements to return $card_body.append($p); $card.append($card_body); $col.append($card); return $col; } +// Method called when "All" or "None" is clicked +function toggleFilterButtons(filterQuery, state) { + $(".filter-button-" + filterQuery).each(function() { + $(this).prop('checked', state); + }); + filtersUpdated(); +} + // Method called when any filter is changed to reload the spots and persist the filter settings. function filtersUpdated() { loadSpots(); @@ -373,18 +389,6 @@ function setUpEventListeners() { $("#filters-button").button("toggle"); $("#filters-area").hide(); }); - $("#select-all-button").click(function() { - $(".storeable-checkbox").each(function() { - $(this).prop('checked', true); - }); - filtersUpdated(); - }); - $("#deselect-all-button").click(function() { - $(".storeable-checkbox").each(function() { - $(this).prop('checked', false); - }); - filtersUpdated(); - }); } // Startup