From: Richard Fairhurst Date: Sat, 8 Mar 2014 11:14:48 +0000 (+0000) Subject: Add spinner while awaiting route X-Git-Tag: live~4842^2~35 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/902f1b088743b1983ef5bbb2ac7a3c8f2fadbdf1 Add spinner while awaiting route --- diff --git a/app/assets/images/searching-small.gif b/app/assets/images/searching-small.gif new file mode 100644 index 000000000..06dbc2bc2 Binary files /dev/null and b/app/assets/images/searching-small.gif differ diff --git a/app/assets/javascripts/routing.js.erb b/app/assets/javascripts/routing.js.erb index fb03e5bec..af9ce4fbf 100644 --- a/app/assets/javascripts/routing.js.erb +++ b/app/assets/javascripts/routing.js.erb @@ -9,8 +9,6 @@ *** translation (including all alerts and presentation) *** export GPX *** URL history (or do we consciously not want to support that?) - *** spinner when waiting for result (beneath 'Go' button?) - *** add YOURS engine */ @@ -161,6 +159,7 @@ OSM.Routing=function(map,name,jqSearch) { r.requestRoute=function(isFinal, updateZoom) { if (r.route_from && r.route_to) { + $(".query_wrapper.routing .spinner").show(); r.awaitingRoute=true; r.chosenEngine.getRoute(isFinal,[r.route_from,r.route_to]); if(updateZoom){ @@ -247,7 +246,10 @@ OSM.Routing=function(map,name,jqSearch) { script.src = url+r.name+".gotRoute"+num; document.body.appendChild(script); }; - r['gotRoute'+num]=function(data) { r.awaitingRoute=false; list[num].gotRoute(r,data); }; + r['gotRoute'+num]=function(data) { + r.awaitingRoute=false; list[num].gotRoute(r,data); + $(".query_wrapper.routing .spinner").hide(); + }; } select.append(""); } diff --git a/app/views/layouts/_search.html.erb b/app/views/layouts/_search.html.erb index e9aa76f5a..839b3dcec 100644 --- a/app/views/layouts/_search.html.erb +++ b/app/views/layouts/_search.html.erb @@ -20,6 +20,7 @@ <%= image_tag "marker-red.png" , :class => 'routing_marker', :id => 'marker_to' , :draggable => 'true' %> <%= text_field_tag "route_to" , params[:to] , :placeholder => t('site.search.to') , :onchange=>"OSM.routing.geocode('route_to' ,event)" %> + <%= image_tag "searching-small.gif", :class => 'spinner', :style => "vertical-align: middle; display: none;" %> <% end %>