]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions.js
Updated min bounds algorithm
[rails.git] / app / assets / javascripts / index / directions.js
index 392183cc601263ac24eaaac37be189c24b555e25..8a80328cc05c3767813ac7ff3823330001095d9e 100644 (file)
@@ -54,6 +54,10 @@ OSM.Directions = function (map) {
       }
     });
 
+    input.on("keydown", function() {
+      input.removeClass("error");
+    });
+
     input.on("change", function (e) {
       awaitingGeocode = true;
       
@@ -65,6 +69,7 @@ OSM.Directions = function (map) {
     endpoint.setValue = function(value, latlng) {
       endpoint.value = value;
       delete endpoint.latlng;
+      input.removeClass("error");
       input.val(value);
 
       if (latlng) {
@@ -87,7 +92,8 @@ OSM.Directions = function (map) {
         endpoint.awaitingGeocode = false;
         endpoint.hasGeocode = true;
         if (json.length === 0) {
-          alert(I18n.t('javascripts.directions.errors.no_place'));
+          input.addClass("error");
+          alert(I18n.t('javascripts.directions.errors.no_place', {place: endpoint.value}));
           return;
         }