Use larger 'spinner' when waiting for route request. Replace HTML in content to avoid...
authorMatt Amos <zerebubuth@gmail.com>
Mon, 26 Jan 2015 17:18:32 +0000 (17:18 +0000)
committerMatt Amos <zerebubuth@gmail.com>
Mon, 26 Jan 2015 17:18:32 +0000 (17:18 +0000)
app/assets/javascripts/index/directions.js.erb
app/views/layouts/_search.html.erb

index 3e2251b7ae8929d5c970353f4e61a3b48d68123a..a8f4feb786a9d44fa9a280f4d3968bfdf35a532b 100644 (file)
@@ -166,14 +166,16 @@ OSM.Directions = function (map) {
              d.lat.toFixed(precision) + ',' + d.lng.toFixed(precision)
     }));
 
-    $(".directions_form .spinner").show();
+    // copy loading item to sidebar and display it. we copy it, rather than
+    // just using it in-place and replacing it in case it has to be used
+    // again.
+    $('#sidebar_content').html($('.directions_form .loader_copy').html());
     awaitingRoute = true;
+    map.setSidebarOverlaid(false);
 
     chosenEngine.getRoute([o, d], function (err, route) {
       awaitingRoute = false;
 
-      $(".directions_form .spinner").hide();
-
       if (err) {
         map.removeLayer(polyline);
 
@@ -188,8 +190,6 @@ OSM.Directions = function (map) {
         .setLatLngs(route.line)
         .addTo(map);
 
-      map.setSidebarOverlaid(false);
-
       if (!dragging) {
         map.fitBounds(polyline.getBounds().pad(0.05));
       }
index 5b6806e3d8d9fa47dbd3aece8d324b863a822516..441ea3212ab8249396c15c7f4d0a89049c25248f 100644 (file)
@@ -21,6 +21,6 @@
     </div>
     <select class='routing_engines' name='routing_engines'></select>
     <div width="100%" align="right"><%= submit_tag t('site.search.submit_text') %></div>
-    <%= image_tag "searching-small.gif", :class => 'spinner', :style => "vertical-align: middle; display: none;" %>
+    <div class="loader_copy" style="display:none;"><div class="loader"><%= image_tag "searching.gif", :style => "vertical-align: middle;" %></div></div>
   </form>
 </div>