From: Richard Fairhurst Date: Tue, 21 Jan 2014 19:22:50 +0000 (+0000) Subject: Presentation work X-Git-Tag: live~4842^2~66 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/69437cf0ad12550ebfaadea56d074ac9996b8ca0 Presentation work --- diff --git a/app/assets/images/routing-sprite.png b/app/assets/images/routing-sprite.png new file mode 100644 index 000000000..37d94886d Binary files /dev/null and b/app/assets/images/routing-sprite.png differ diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 4645a3e2e..74ec05823 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -351,12 +351,14 @@ $(document).ready(function () { e.preventDefault(); $(".query_wrapper.search").hide(); $(".query_wrapper.routing").show(); + $(".query_wrapper.routing [name=route_from]").focus(); }); $(".close_directions").on("click",function(e) { e.preventDefault(); $(".query_wrapper.search").show(); $(".query_wrapper.routing").hide(); + $(".query_wrapper.search [name=query]").focus(); }); OSM.routing = OSM.Routing(map,'OSM.routing',$('.query_wrapper.routing')); diff --git a/app/assets/javascripts/routing.js.erb b/app/assets/javascripts/routing.js.erb index 30846479d..1f50fa480 100644 --- a/app/assets/javascripts/routing.js.erb +++ b/app/assets/javascripts/routing.js.erb @@ -7,7 +7,9 @@ https://github.com/apmon/openstreetmap-website/blob/9755c3ae0a8d0684d43760f91dc864ff42d8477a/app/views/routing/start.js.erb *** draggable start/end markers - + *** click each part + *** translation (including all alerts and presentation) + *** export GPX */ var TURN_INSTRUCTIONS=["", @@ -85,22 +87,31 @@ OSM.Routing=function(map,name,jqSearch) { r.setPolyline=function(line) { if (r.polyline) map.removeLayer(r.polyline); r.polyline=L.polyline(line, ROUTING_POLYLINE).addTo(r.map); - // *** zoom to fit + r.map.fitBounds(r.polyline.getBounds()); }; // Take an array of directions and write it out // (we use OSRM's route_instructions format) + // *** translations? r.setItinerary=function(steps) { $("#content").removeClass("overlay-sidebar"); $('#sidebar_content').empty(); - var html=""; + var html='

Directions

'; + html+=""; for (var i=0; i "; + instText+=TURN_INSTRUCTIONS[instCodes[0]]; + if (instCodes[1]) { instText+="exit "+instCodes[1]+" "; } + if (instCodes[0]!=15) { instText+=step[1] ? ""+step[1]+"" : "(unnamed)"; } + // Add to table + html+=""; + html+="
"; + html+=""+instText; } + html+="
"; $('#sidebar_content').html(html); }; @@ -147,7 +158,11 @@ OSM.Routing=function(map,name,jqSearch) { this.requestJSONP(url); }, gotRoute: function(data) { - // *** save hints + if (data.status==207) { + alert("Couldn't find route between those two places"); + return false; + } + // *** store hints var line=L.PolylineUtil.decode(data.route_geometry); for (i=0; itable { + margin: 20px 0px 10px 15px; +} + +td.direction { + background-image: image-url('routing-sprite.png'); + width: 20px; height: 20px; + background-repeat: no-repeat; +} +@for $i from 1 through 17 { +td.direction.i#{$i} { background-position: #{($i)*-20+20}px 0px; } +} + /* Rules for entity history */ #sidebar_content { diff --git a/config/locales/en.yml b/config/locales/en.yml index 9efda4556..4bc926f2b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1324,6 +1324,10 @@ en: close: Close search: search: Search + get_directions: "Get directions" + get_directions_title: "Find directions between two points" + close_directions: "Close directions" + close_directions_title: "Close the directions panel" where_am_i: "Where am I?" where_am_i_title: Describe the current location using the search engine submit_text: "Go"