diff --git a/static/js/add-spot.js b/static/js/add-spot.js index dec7188..9c187f4 100644 --- a/static/js/add-spot.js +++ b/static/js/add-spot.js @@ -150,6 +150,9 @@ function loadCredentials(providerName) { // Method called to add a spot to the server function addSpot() { try { + $("#result-bad").empty(); + setSubmitting(true); + // Save settings (this will save "your call" for future use) saveSettings(); @@ -214,6 +217,7 @@ function addSpot() { }, 2000); }, error: function (result) { + setSubmitting(false); if (window._recaptchaWidgetId !== undefined) { grecaptcha.reset(window._recaptchaWidgetId); } @@ -225,11 +229,19 @@ function addSpot() { } }); } catch (error) { + setSubmitting(false); showAddSpotError(error); } return false; } +// Show or hide the "in progress" state on the Spot button. +function setSubmitting(submitting) { + $("#add-spot-submit").prop("disabled", submitting); + $("#add-spot-spinner").toggle(submitting); + $("#add-spot-submit-text").text(submitting ? "Spotting..." : "Spot"); +} + // Show an "add spot" error. function showAddSpotError(text) { const div = $(""); diff --git a/templates/add-spot.html b/templates/add-spot.html index 156136c..b509896 100644 --- a/templates/add-spot.html +++ b/templates/add-spot.html @@ -72,7 +72,11 @@ placeholder="N0CALL" required>
- +
@@ -138,7 +142,7 @@ const ALLOW_UPSTREAM_SPOTTING = {% raw safe_json_dumps(web_ui_options["allow_upstream_spotting"]) %}; - + diff --git a/templates/alerts.html b/templates/alerts.html index 5523f16..45ceed6 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -87,7 +87,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 25aa23a..1987a87 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -82,8 +82,8 @@ const BANDS = {% raw safe_json_dumps(options["bands"]) %}; - - + + diff --git a/templates/base.html b/templates/base.html index 530b8ea..dab7428 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -16,10 +16,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index 25dbbf2..3dc3791 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index 96d3745..c1d5b08 100644 --- a/templates/map.html +++ b/templates/map.html @@ -115,8 +115,8 @@ const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}"; - - + + diff --git a/templates/spots.html b/templates/spots.html index a0cf0e4..b7384af 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -127,8 +127,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index 920d60b..af3f137 100644 --- a/templates/status.html +++ b/templates/status.html @@ -96,7 +96,7 @@ - +