Commit be50abba51847fca6c3efb2ce30d1d0d6646c5bf
1 parent
1672fd6e
Exists in
master
and in
22 other branches
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.
Showing
4 changed files
with
6 additions
and
7 deletions
Show diff stats
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