From 69437cf0ad12550ebfaadea56d074ac9996b8ca0 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Tue, 21 Jan 2014 19:22:50 +0000 Subject: [PATCH] Presentation work --- app/assets/images/routing-sprite.png | Bin 0 -> 1770 bytes app/assets/javascripts/index.js | 2 ++ app/assets/javascripts/routing.js.erb | 33 ++++++++++++++++++------- app/assets/stylesheets/common.css.scss | 15 +++++++++++ config/locales/en.yml | 4 +++ 5 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 app/assets/images/routing-sprite.png diff --git a/app/assets/images/routing-sprite.png b/app/assets/images/routing-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..37d94886ddf07ea4074f92c01584394761984983 GIT binary patch literal 1770 zcmVxx#T*F9q_3p z3ce)@b|XnXjI1#(TjCGIEG2P_gg(KajYiz&R?Ys5x#+O{v0^<`OZ0DUJW$SaLi@WQ zX3n+h;#50BV_VYTSlC%gVuNcg^ex4Jro!vj1k`O>dc@7ww`#<%!n4TwL9Dm{Mb;`4 z0&fsx;HM4HDj+=<9xMz{Giki07_W&_iBcnLUd*00uN(b`*=#*+c7(~rjz!UqfR+fn zSln90q6PiS=rzxH@tn5UF{6bQnOc9w8PX|hcj94>lY?5pKi==wONpOiPGe<29VL2b zx3HdbKzQFm9%F5thuwU@W+s@DQ+>$nO`5J-7+{HUOfBtSPXy8pyYAtL-VsM`C1J8y|ok0f8|cEEo$T$SpoMQ>I{+&ra1s$XvXZBP_9eZ1mW3{dp@LEa&de zI6y-2y+>>vqu;5Jou&i?Ypj(*2++NM#~S|45I>dt5^|9F0_wo*?F?{=0CflBh?NVa z7JzbVnPOgZ0R=}u?S^Rn!06UY7&W^Iz*h_;*=s2Q2cwRx$?`!X76R(OW23vrRF!M2 z$e?}tGX>P^N;iDq&96!~MpgXNjGtD1nVnVvP=^RwOLO52s0dgcqW{mt@aOoYjnewv zrk|<`?^JL3-DT{MYsrE=xzn8x7Trx{2`nM`g!S2})BcD7Yr}l41b~|L3>iCS{XpH^qWQMa&+d>h9bQj-?!r3?G$SItN8p>|B!ayHh{ z1%R4Z+Se(q{fTEabM$8x^B++~%O;Fy{9*KaeD&D@qv@Y&{50~5-1JcFfp&7?-rc+A`jYvk@q`H^>H}jd-4zRm zjlwx>F1Bpgei=5!8?Eq(mR)g&PI41{6bss_*|FTiWJ&DNP2@*2?c45L+B!pj?qdc0 zHhe8`$bqJbVKm8i<^pl$uG}sg2pU07z>-`q$gUsnah;-z2BLHu@E^ z^wz<@a$zy+6!W>6@R|BNpTI!?Jf-~v2bBBxugjB8eL+?Xm`V!~nc`p412pq*BlJ&O zX3Hj=(pt58%BS}CAN)+?VQx_yFD>n0-!#RlHtC^7s;`gjNX`W&u@;kMWs}l4HrX8F)xJj-Mf^S>?4xoE`;Sw(LLF%f$LrU^t4$J zlh1JZ=517d&WZJycHTB`-#2>8yuZZ&rV{%1!+?MJ0p+(v#@O*e1%D9bQ$k!yCEp=m zH*Me?80z_q&ZTye4>(@1wp^fY7UUNI!s|xABZpz{=oN{d<{ALN&y47bMrJe?MdJru73v%cq zpWhq>P%$qL@ZWo|>%ymhSp56sdHPLMj9s-);u5C(=agt%&#FQ+f&`gWN&>F4%PRb0 ze~=&^1@v?aRnLBM-iW0MJ+G3_ddYI{*Lx M07*qoM6N<$f|-VHxBvhE literal 0 HcmV?d00001 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" -- 2.43.2