From 8de163469b0c0fbcae21c108f2a34bc60a37edd3 Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Fri, 25 Sep 2026 21:22:31 +0100 Subject: [PATCH] Replace pages' use of the options call with directly building the HTML components using templates, as the syntax is much nicer. Use a common set of data provided to all modules via pagetemplate.py instead of passing things like web_ui_options around. Closes #153 --- static/js/add-spot.js | 61 +++------- static/js/alerts.js | 38 ++---- static/js/bands.js | 56 +++------ static/js/common.js | 74 +----------- static/js/map.js | 87 +++++-------- static/js/spots.js | 69 ++++------- static/js/spotsbandsandmap.js | 56 ++------- templates/add-spot.html | 61 +++++++++- templates/alerts.html | 34 +++--- templates/bands.html | 42 ++++--- templates/base.html | 12 +- templates/cards/activities.html | 56 ++++++++- templates/cards/bands.html | 24 +++- templates/cards/color_scheme.html | 2 +- .../color_scheme_and_band_color_scheme.html | 4 +- templates/cards/de_continent.html | 19 ++- templates/cards/dx_continent.html | 19 ++- templates/cards/modes.html | 24 +++- templates/cards/sources.html | 23 +++- templates/conditions.html | 2 +- templates/help/usage/web.html | 2 +- templates/map.html | 42 ++++--- templates/spots.html | 52 ++++---- templates/status.html | 2 +- webserver/handlers/api/options.py | 114 ++++++++---------- webserver/handlers/pagetemplate.py | 34 ++++-- webserver/webserver.py | 18 +-- 27 files changed, 493 insertions(+), 534 deletions(-) diff --git a/static/js/add-spot.js b/static/js/add-spot.js index ad8d21c..7ef87b5 100644 --- a/static/js/add-spot.js +++ b/static/js/add-spot.js @@ -26,45 +26,8 @@ const PROVIDER_CREDENTIAL_SCHEMAS = { ] }; -// Load server options. Once a successful callback is made from this, we can populate the choice boxes in the form and load -// any saved values from local storage. -function loadOptions() { - $.getJSON('/api/v3/options', function (jsonData) { - // Store options - options = jsonData; - - // Populate modes drop-down - $.each(options["modes"], function (i, m) { - $('#mode').append($('