Commit 0cb5d2cc937b74773a2ccf73b65a2823baacae81

Authored by AntonioTerceiro
1 parent 95e7135c

ActionItem265: notifying missing items in map

if at least one item should be shown in the map but it is no possible to
show it (i.e. it does not have latitude and/or longitude), then display
a infoWindow saying that.


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1966 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 9 additions and 2 deletions   Show diff stats
app/views/search/_google_maps.rhtml
@@ -28,17 +28,24 @@ if (GBrowserIsCompatible()) { @@ -28,17 +28,24 @@ if (GBrowserIsCompatible()) {
28 map.addControl(new GLargeMapControl()); 28 map.addControl(new GLargeMapControl());
29 map.addControl(new GMapTypeControl()); 29 map.addControl(new GMapTypeControl());
30 30
31 - map.setCenter(new GLatLng(-15.0, -50.1419), 4); 31 + centerPoint = new GLatLng(-15.0, -50.1419);
  32 + map.setCenter(centerPoint, 4);
32 <% 33 <%
  34 + missed = false
33 @results.each do |name,results| 35 @results.each do |name,results|
34 results.each do |item| 36 results.each do |item|
35 if item.lat && item.lng 37 if item.lat && item.lng
36 %> 38 %>
37 putMarker(<%= item.lat.to_json %>, <%= item.lng.to_json %>, <%= item.name.to_json %>, <%= display_profile_info(item).to_json %>); 39 putMarker(<%= item.lat.to_json %>, <%= item.lng.to_json %>, <%= item.name.to_json %>, <%= display_profile_info(item).to_json %>);
38 <% 40 <%
39 - end 41 + else
  42 + missed = true
  43 + end
40 end 44 end
41 end 45 end
42 %> 46 %>
  47 + <% if missed %>
  48 + <%= "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 %>
  49 + <% end %>
43 } 50 }
44 </script> 51 </script>