community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r894263 - /comdev/nearby_people/templates/people.html
Date Mon, 28 Dec 2009 22:51:46 GMT
Author: rgardler
Date: Mon Dec 28 22:51:45 2009
New Revision: 894263

URL: http://svn.apache.org/viewvc?rev=894263&view=rev
Log:
Display a list of projects in the info box

Modified:
    comdev/nearby_people/templates/people.html

Modified: comdev/nearby_people/templates/people.html
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/people.html?rev=894263&r1=894262&r2=894263&view=diff
==============================================================================
--- comdev/nearby_people/templates/people.html (original)
+++ comdev/nearby_people/templates/people.html Mon Dec 28 22:51:45 2009
@@ -20,7 +20,7 @@
 $(document).ready(function(){
 	if (GBrowserIsCompatible()) {
 		map = new GMap2(document.getElementById('map'));
-        map.addControl(new GLargeMapControl());
+		map.addControl(new GLargeMapControl());
         map.setCenter(new GLatLng({{center_lat}}, {{center_long}}), 14);
 
         // Zoom to roughly the right place
@@ -34,8 +34,12 @@
 
         // Add our markers
         {% for dist, person in people %}
+            var projectNames = new Array();
+            {% for project in person.projects %}
+                projectNames.push("{{project.name}}");
+            {% endfor %}
             marker = createMarker("{{person.name}}",{{person.latitude}},
-                         {{person.longitude}},"{{person.link}}");
+                         {{person.longitude}},"{{person.link}}", projectNames);
             map.addOverlay(marker);
             markers["{{person.uid}}"] = marker;
         {% endfor %}
@@ -52,27 +56,25 @@
     }
 });
 
-function createMarker(name,lat,lng,link) {
-    var point = new GLatLng(lat,lng);
+function createMarker(name,lat,lng,link,projects) {
+	var point = new GLatLng(lat,lng);
     var options = { title: name }; // appears when cursor hovers over marker
     var marker = new GMarker(point,options);
     GEvent.addListener(marker, "click", function() {
       var msg = name + "<br \/>";
+      msg = msg + " <ul>";
+      for (var i = 0; i < projects.length; i++) {
+    	  msg = msg + "<li>" + projects[i] + "</li>";
+    	};
+      msg = msg + " </ul>";
       msg = msg + " <a href=\"" + link + "\">" +
                   "<small>Info<\/small><\/a>"; 
       marker.openInfoWindowHtml(msg);
     });
-
-	GEvent.addListener(marker, "click", function(){
-		map.panTo(marker.getLatLng());
-	});
 	
     return marker;
 }
 
-function panTo(name) {
-	map.panTo(markers[name].getLatLng());
-}
 //-->
 </script>
 <style type="text/css">
@@ -95,7 +97,7 @@
 	<table id="people">
 	  {% for dist, person in people %}
 		<tr>
-		  <td><a href="javascript:panTo('{{person.uid}}')">{{person.name}}</a></td>
+		  <td><a href="javascript:map.panTo(markers['{{person.uid}}'].getPoint())">{{person.name}}</a></td>
 		  <td>{{dist|distanceformat}}</td>
 		  <td><a href="{{person.link}}">(info)</a></td>
 		</tr>
@@ -103,7 +105,7 @@
 	</table>
 
 	<div id="map"></div>
-	<script type="text/javascript">load()</script>
+	
 {% else %}
 	<p>Sorry, there's no-one near you :(</p>
 	<p>Maybe <a href="/pick_place/">try somewhere else?</a></p>



Mime
View raw message