]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions.js
Remove/replace redundant no_place locale translation
[rails.git] / app / assets / javascripts / index / directions.js
index 1ad7f9cb70c986a4d6e86ffe1a4d42746075758a..14be8b3583b87fd30ebbdb0f0b1578e487a98d54 100644 (file)
@@ -53,7 +53,13 @@ OSM.Directions = function (map) {
       }
     });
 
+    input.on("keydown", function() {
+      input.css("background-color", "#fff");
+    });
+
     input.on("change", function (e) {
+      awaitingGeocode = true;
+      
       // make text the same in both text boxes
       var value = e.target.value;
       endpoint.setValue(value);
@@ -84,16 +90,14 @@ 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', {place: endpoint.value}));
+          input.css("background-color", "rgba(255, 0, 0, 0.5)");
           return;
         }
 
-        input.val(json[0].display_name);
+        endpoint.setLatLng(L.latLng(json[0]));
 
-        endpoint.latlng = L.latLng(json[0]);
-        endpoint.marker
-          .setLatLng(endpoint.latlng)
-          .addTo(map);
+        input.val(json[0].display_name);
 
         if (awaitingGeocode) {
           awaitingGeocode = false;