Commit 944fc8303b7aa0e1cf74022c16312e9f38017972

Authored by JoenioCosta
1 parent dc22707b

ActionItem512: add custom icon to google map

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2142 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/search/_google_maps.rhtml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 </div> 6 </div>
7 7
8 <script type='text/javascript'> 8 <script type='text/javascript'>
9 -  
10 var points = {}; 9 var points = {};
11 10
12 function putMarker(lat, lng, title, summary) { 11 function putMarker(lat, lng, title, summary) {
@@ -20,7 +19,7 @@ function putMarker(lat, lng, title, summary) { @@ -20,7 +19,7 @@ function putMarker(lat, lng, title, summary) {
20 } 19 }
21 20
22 var point = new GLatLng(lat, lng); 21 var point = new GLatLng(lat, lng);
23 - var options = { 'title' : title }; 22 + var options = { 'title' : title, 'icon' : icon };
24 var marker = new GMarker(point, options); 23 var marker = new GMarker(point, options);
25 map.addOverlay(marker); 24 map.addOverlay(marker);
26 GEvent.addListener(marker, 'click', function() { 25 GEvent.addListener(marker, 'click', function() {
@@ -44,13 +43,19 @@ if (GBrowserIsCompatible()) { @@ -44,13 +43,19 @@ if (GBrowserIsCompatible()) {
44 map.setCenter(centerPoint, <%= GoogleMaps.initial_zoom.to_json %>); 43 map.setCenter(centerPoint, <%= GoogleMaps.initial_zoom.to_json %>);
45 var bounds = new GLatLngBounds(); 44 var bounds = new GLatLngBounds();
46 45
  46 + var baseIcon = new GIcon();
  47 + baseIcon.iconSize=new GSize(32,32);
  48 + baseIcon.shadowSize=new GSize(36,32);
  49 + baseIcon.iconAnchor=new GPoint(16,32);
  50 + baseIcon.infoWindowAnchor=new GPoint(16,0);
  51 + var icon = new GIcon(baseIcon, "/images/icons-map/enterprise.png", null, "/images/icons-map/enterprise_shadow.png");
  52 +
47 <% 53 <%
48 missed = false 54 missed = false
49 @results.each do |name,results| 55 @results.each do |name,results|
50 results.each do |item| 56 results.each do |item|
51 if item.lat && item.lng 57 if item.lat && item.lng
52 %> 58 %>
53 -  
54 putMarker(<%= item.lat.to_json %>, <%= item.lng.to_json %>, <%= item.name.to_json %>, <%= display_profile_info(item).to_json %>); 59 putMarker(<%= item.lat.to_json %>, <%= item.lng.to_json %>, <%= item.name.to_json %>, <%= display_profile_info(item).to_json %>);
55 <% 60 <%
56 else 61 else
public/images/icons-map/enterprise.png 0 → 100644

4.76 KB

public/images/icons-map/enterprise_shadow.png 0 → 100644

1.72 KB