Commit be50abba51847fca6c3efb2ce30d1d0d6646c5bf

Authored by Rodrigo Souto
1 parent 1672fd6e

search: google-maps is loaded only once

Google Maps lib was being loaded on every submit. I moved the include to
the search page, outside the search content.
app/views/search/_google_maps.html.erb
@@ -3,12 +3,7 @@ @@ -3,12 +3,7 @@
3 <div id="map"></div> 3 <div id="map"></div>
4 </div> 4 </div>
5 5
6 -<%= content_tag('script', '', :src => "http://maps.google.com/maps/api/js?sensor=true", :type => 'text/javascript') %>  
7 -<%= javascript_include_tag('google_maps') %>  
8 -  
9 -<%  
10 - icon = default_or_themed_icon("/images/icons-map/enterprise.png")  
11 -%> 6 +<% icon = default_or_themed_icon("/images/icons-map/enterprise.png") %>
12 7
13 <script type='text/javascript'> 8 <script type='text/javascript'>
14 mapLoad(<%= GoogleMaps.initial_zoom.to_json %>); 9 mapLoad(<%= GoogleMaps.initial_zoom.to_json %>);
app/views/search/search_page.html.erb
@@ -10,3 +10,6 @@ @@ -10,3 +10,6 @@
10 <% end %> 10 <% end %>
11 11
12 <%= javascript_include_tag 'search' %> 12 <%= javascript_include_tag 'search' %>
  13 +
  14 +<%= content_tag('script', '', :src => "http://maps.google.com/maps/api/js?sensor=true", :type => 'text/javascript') %>
  15 +<%= javascript_include_tag('google_maps') %>
public/javascripts/search.js
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 return false; 10 return false;
11 }); 11 });
12 12
13 - // Sorting 13 + // Sorting and Views
14 $('#search-filters select').change(function(){ 14 $('#search-filters select').change(function(){
15 $('form.search_form').submit(); 15 $('form.search_form').submit();
16 }); 16 });
public/stylesheets/application.css
@@ -1667,6 +1667,7 @@ a.button.disabled, input.disabled { @@ -1667,6 +1667,7 @@ a.button.disabled, input.disabled {
1667 } 1667 }
1668 #map { 1668 #map {
1669 height: 500px; 1669 height: 500px;
  1670 + margin-top: 10px;
1670 } 1671 }
1671 .map { 1672 .map {
1672 clear: both; 1673 clear: both;