From: Tom Hughes Date: Mon, 2 Apr 2018 14:25:17 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/1801' X-Git-Tag: live~3195 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/10c3230e2716d5791e1007e5762988fec57e0a4d?hp=6f74ae342974a4190517bcccec692d7bed6cb2c8 Merge remote-tracking branch 'upstream/pull/1801' --- diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 1a3e0d4ec..1057fa58d 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.removeClass("error"); + }); + 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')); + input.addClass("error"); + alert(I18n.t('javascripts.directions.errors.no_place', {place: endpoint.value})); return; } diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 4353e5e65..0a5d9164e 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -938,6 +938,10 @@ header .search_forms, border-radius: 0 2px 2px 0; } + input.error { + background-color: rgba($red, 0.4); + } + select { /* this next line is to polyfill the vertical alignment of text within a select element, * which is different between firefox and chrome. */ diff --git a/config/locales/en.yml b/config/locales/en.yml index 4540e74e8..af33f34f8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2325,7 +2325,7 @@ en: distance: "Distance" errors: no_route: "Couldn't find a route between those two places." - no_place: "Sorry - couldn't find that place." + no_place: "Sorry - couldn't locate '%{place}'." instructions: continue_without_exit: Continue on %{name} slight_right_without_exit: Slight right onto %{name}