From: J Guthrie Date: Thu, 29 Mar 2018 19:50:29 +0000 (+0100) Subject: Unlocateable place now highlighted in red and specified in error message X-Git-Tag: live~3102^2~2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/1bb52e3cb6da18a4777c8314088c5cb5c48a484a?ds=inline Unlocateable place now highlighted in red and specified in error message The textbox containing the unlocateable place gets highlighted in red Also added a new locale value to specify an error for a specific place --- diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 1a3e0d4ec..689a6eba8 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -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; } diff --git a/config/locales/en.yml b/config/locales/en.yml index 2aca45255..a8308444a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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}