From 45ebe68d7b1c740be514ff87adbaa832e0b9b212 Mon Sep 17 00:00:00 2001 From: versx Date: Sat, 29 May 2021 14:59:04 -0700 Subject: [PATCH] Ensure a location or area is selected --- src/views/gyms/edit.mustache | 2 +- src/views/gyms/new.mustache | 2 +- src/views/invasions/edit.mustache | 6 +++++- src/views/invasions/new.mustache | 6 +++++- src/views/lures/edit.mustache | 6 +++++- src/views/lures/new.mustache | 6 +++++- src/views/pokemon/edit.mustache | 6 +++++- src/views/pokemon/new.mustache | 6 +++++- src/views/pvp/edit.mustache | 6 +++++- src/views/pvp/new.mustache | 6 +++++- src/views/quests/edit.mustache | 6 +++++- src/views/quests/new.mustache | 6 +++++- src/views/raids/edit.mustache | 6 +++++- src/views/raids/new.mustache | 6 +++++- static/js/city-map.js | 14 ++++++++++++++ 15 files changed, 76 insertions(+), 14 deletions(-) diff --git a/src/views/gyms/edit.mustache b/src/views/gyms/edit.mustache index 34cea74..b64ab98 100644 --- a/src/views/gyms/edit.mustache +++ b/src/views/gyms/edit.mustache @@ -62,7 +62,7 @@
{{Location}} - {{#locations}} diff --git a/src/views/gyms/new.mustache b/src/views/gyms/new.mustache index 78ad18d..a806bad 100644 --- a/src/views/gyms/new.mustache +++ b/src/views/gyms/new.mustache @@ -62,7 +62,7 @@
{{Location}} -
diff --git a/src/views/invasions/edit.mustache b/src/views/invasions/edit.mustache index 410ffb8..6eb41bb 100644 --- a/src/views/invasions/edit.mustache +++ b/src/views/invasions/edit.mustache @@ -45,7 +45,7 @@
{{Location}} - {{#locations}} @@ -56,6 +56,10 @@
+
+ +
diff --git a/src/views/invasions/new.mustache b/src/views/invasions/new.mustache index 5609197..da8fc10 100644 --- a/src/views/invasions/new.mustache +++ b/src/views/invasions/new.mustache @@ -73,7 +73,7 @@
{{Location}} -
@@ -81,6 +81,10 @@
+
+ +
diff --git a/src/views/lures/edit.mustache b/src/views/lures/edit.mustache index 1820fcc..bb8b690 100644 --- a/src/views/lures/edit.mustache +++ b/src/views/lures/edit.mustache @@ -31,7 +31,7 @@
{{Location}} - {{#locations}} @@ -42,6 +42,10 @@
+
+ +
diff --git a/src/views/lures/new.mustache b/src/views/lures/new.mustache index 787d9f4..f86f3e9 100644 --- a/src/views/lures/new.mustache +++ b/src/views/lures/new.mustache @@ -40,7 +40,7 @@
{{Location}} -
@@ -48,6 +48,10 @@
+
+ +
diff --git a/src/views/pokemon/edit.mustache b/src/views/pokemon/edit.mustache index 4d53955..f44656c 100644 --- a/src/views/pokemon/edit.mustache +++ b/src/views/pokemon/edit.mustache @@ -73,7 +73,7 @@
{{Location}} - {{#locations}} @@ -84,6 +84,10 @@
+
+ +
diff --git a/src/views/pokemon/new.mustache b/src/views/pokemon/new.mustache index 37041ed..08fc1c5 100644 --- a/src/views/pokemon/new.mustache +++ b/src/views/pokemon/new.mustache @@ -101,7 +101,7 @@
{{Location}} -
@@ -109,6 +109,10 @@
+
+ +
diff --git a/src/views/pvp/edit.mustache b/src/views/pvp/edit.mustache index 66952fe..cefcff0 100644 --- a/src/views/pvp/edit.mustache +++ b/src/views/pvp/edit.mustache @@ -60,7 +60,7 @@
{{Location}} - {{#locations}} @@ -71,6 +71,10 @@
+
+ +
diff --git a/src/views/pvp/new.mustache b/src/views/pvp/new.mustache index abf3cb8..1d0c94c 100644 --- a/src/views/pvp/new.mustache +++ b/src/views/pvp/new.mustache @@ -92,7 +92,7 @@
{{Location}} -
@@ -100,6 +100,10 @@
+
+ +
diff --git a/src/views/quests/edit.mustache b/src/views/quests/edit.mustache index d17551c..b0a636c 100644 --- a/src/views/quests/edit.mustache +++ b/src/views/quests/edit.mustache @@ -31,7 +31,7 @@
{{Location}} - {{#locations}} @@ -42,6 +42,10 @@
+
+ +
diff --git a/src/views/quests/new.mustache b/src/views/quests/new.mustache index 1fe3d6f..3b9199b 100644 --- a/src/views/quests/new.mustache +++ b/src/views/quests/new.mustache @@ -47,7 +47,7 @@
{{Location}} -
@@ -55,6 +55,10 @@
+
+ +
diff --git a/src/views/raids/edit.mustache b/src/views/raids/edit.mustache index 58db87b..b178eda 100644 --- a/src/views/raids/edit.mustache +++ b/src/views/raids/edit.mustache @@ -43,7 +43,7 @@
{{Location}} - {{#locations}} @@ -54,6 +54,10 @@
+
+ +
diff --git a/src/views/raids/new.mustache b/src/views/raids/new.mustache index ef9ff8f..c2b7a86 100644 --- a/src/views/raids/new.mustache +++ b/src/views/raids/new.mustache @@ -72,7 +72,7 @@
{{Location}} -
@@ -80,6 +80,10 @@
+
+ +
diff --git a/static/js/city-map.js b/static/js/city-map.js index 575b4c2..9af5635 100644 --- a/static/js/city-map.js +++ b/static/js/city-map.js @@ -5,6 +5,20 @@ let geofenceDb = {}; let selectedGeofences = []; let initialSelect = []; +$('form').submit(function(e) { + const city = $('#city').val(); + const location = $('#location').val(); + const result = city !== '' || location !== ''; + console.log('result:', result); + if (!result) { + // TODO: Show error message about location/areas selection + $('#error-div').prop('hidden', false); + $('#error-div').html('
Error! Please select either an area and/or location to receive the notification.
'); + e.preventDefault(); + } + return result; +}); + function initMap(startLocation, startZoom, minZoom, maxZoom, tileserver, selected = []) { const map = L.map('map', { tap: false,