diff --git a/app/views/search/_google_maps.rhtml b/app/views/search/_google_maps.rhtml
index c0f983e..8241c07 100644
--- a/app/views/search/_google_maps.rhtml
+++ b/app/views/search/_google_maps.rhtml
@@ -10,7 +10,6 @@
var points = {};
function putMarker(lat, lng, title, summary) {
-
var point_str = lat + ":" + lng;
if (points[point_str]) {
@@ -21,13 +20,13 @@ function putMarker(lat, lng, title, summary) {
}
var point = new GLatLng(lat, lng);
-
var options = { 'title' : title };
var marker = new GMarker(point, options);
map.addOverlay(marker);
GEvent.addListener(marker, 'click', function() {
map.openInfoWindowHtml(point, summary);
});
+ bounds.extend(point);
}
window.unload = function() {
@@ -43,12 +42,15 @@ if (GBrowserIsCompatible()) {
centerPoint = new GLatLng(-15.0, -50.1419);
map.setCenter(centerPoint, <%= GoogleMaps.initial_zoom.to_json %>);
+ var bounds = new GLatLngBounds();
+
<%
missed = false
@results.each do |name,results|
results.each do |item|
if item.lat && item.lng
%>
+
putMarker(<%= item.lat.to_json %>, <%= item.lng.to_json %>, <%= item.name.to_json %>, <%= display_profile_info(item).to_json %>);
<%
else
@@ -61,4 +63,7 @@ if (GBrowserIsCompatible()) {
<%= "map.openInfoWindowHtml(centerPoint, %s);" % _("One or more items don't have geographical information, and won't be shown in the map. Choose \"Display in list\" to see them.").to_json %>
<% end %>
}
+
+ map.setZoom(map.getBoundsZoomLevel(bounds));
+ map.setCenter(bounds.getCenter());
--
libgit2 0.21.2