]> git.openstreetmap.org Git - rails.git/commitdiff
Add spinner while awaiting route
authorRichard Fairhurst <richard@systemeD.net>
Sat, 8 Mar 2014 11:14:48 +0000 (11:14 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Sat, 8 Mar 2014 11:14:48 +0000 (11:14 +0000)
app/assets/images/searching-small.gif [new file with mode: 0644]
app/assets/javascripts/routing.js.erb
app/views/layouts/_search.html.erb

diff --git a/app/assets/images/searching-small.gif b/app/assets/images/searching-small.gif
new file mode 100644 (file)
index 0000000..06dbc2b
Binary files /dev/null and b/app/assets/images/searching-small.gif differ
index fb03e5bec9c1b32de13b8e3fd89ef18b7712ac24..af9ce4fbf95dc6f9430919a305354235dd48ce5b 100644 (file)
@@ -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("<option value='"+i+"'>"+I18n.t(list[i].name)+"</option>");
        }
index e9aa76f5a47c89bce57741c105c5ab96b837859c..839b3dceca6106b270fef6d3ed06be633fc29e84 100644 (file)
@@ -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)" %>
     <select class='routing_engines' name='routing_engines' onchange="OSM.routing.selectEngine(event)"></select>
+    <%= image_tag "searching-small.gif", :class => 'spinner', :style => "vertical-align: middle; display: none;" %>
   </div>
 
 <% end %>