]> git.openstreetmap.org Git - rails.git/commitdiff
Unlocateable place now highlighted in red and specified in error message
authorJ Guthrie <jamie.guthrie@gmail.com>
Thu, 29 Mar 2018 19:50:29 +0000 (20:50 +0100)
committerJ Guthrie <jamie.guthrie@gmail.com>
Thu, 29 Mar 2018 20:02:42 +0000 (21:02 +0100)
The textbox containing the unlocateable place gets highlighted in red
Also added a new locale value to specify an error for a specific place

app/assets/javascripts/index/directions.js
config/locales/en.yml

index 1a3e0d4ecae558056b2b9867c4ea2ea0fe4b9920..689a6eba8e24b5003df8e6c8bc19faad2b6e27ba 100644 (file)
@@ -53,6 +53,10 @@ OSM.Directions = function (map) {
       }
     });
 
+    input.on("keydown", function() {
+      input.css("background-color", "#fff");
+    });
+
     input.on("change", function (e) {
       awaitingGeocode = true;
       
@@ -86,7 +90,8 @@ OSM.Directions = function (map) {
         endpoint.awaitingGeocode = false;
         endpoint.hasGeocode = true;
         if (json.length === 0) {
-          alert(I18n.t('javascripts.directions.errors.no_place'));
+          alert(I18n.t('javascripts.directions.errors.no_place_with_name', {place: endpoint.value}));
+          input.css("background-color", "rgba(255, 0, 0, 0.5)");
           return;
         }
 
index 2aca45255291e4d609731038019d52b31d777686..a8308444a6519d4301de53540e9de967ade910c6 100644 (file)
@@ -2326,6 +2326,7 @@ en:
       errors:
         no_route: "Couldn't find a route between those two places."
         no_place: "Sorry - couldn't find that place."
+        no_place_with_name: "Sorry - couldn't locate '%{place}'."
       instructions:
         continue_without_exit: Continue on %{name}
         slight_right_without_exit: Slight right onto %{name}