community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1745876 - in /comdev/nearby_people: nearby/forms.py nearby/shortcuts.py nearby/views.py templates/map.html templates/welcome.html urls.py
Date Sat, 28 May 2016 14:13:14 GMT
Author: nick
Date: Sat May 28 14:13:14 2016
New Revision: 1745876

URL: http://svn.apache.org/viewvc?rev=1745876&view=rev
Log:
Start to provide a "all public committers" map too

Added:
    comdev/nearby_people/templates/map.html
Modified:
    comdev/nearby_people/nearby/forms.py
    comdev/nearby_people/nearby/shortcuts.py
    comdev/nearby_people/nearby/views.py
    comdev/nearby_people/templates/welcome.html
    comdev/nearby_people/urls.py

Modified: comdev/nearby_people/nearby/forms.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/forms.py?rev=1745876&r1=1745875&r2=1745876&view=diff
==============================================================================
--- comdev/nearby_people/nearby/forms.py (original)
+++ comdev/nearby_people/nearby/forms.py Sat May 28 14:13:14 2016
@@ -19,7 +19,7 @@ from django import forms
 
 types_field = forms.TypedChoiceField(choices=(
         ('','Default (Local Mentors)'), ('lm','Local Mentors'),
-        ('sp','Speakers'),
+        ('sp','Speakers'), ('all','All Public Committers')
     ), 
     required=False,
     widget=forms.HiddenInput,

Modified: comdev/nearby_people/nearby/shortcuts.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/shortcuts.py?rev=1745876&r1=1745875&r2=1745876&view=diff
==============================================================================
--- comdev/nearby_people/nearby/shortcuts.py (original)
+++ comdev/nearby_people/nearby/shortcuts.py Sat May 28 14:13:14 2016
@@ -23,7 +23,8 @@ from django.template import RequestConte
 
 mimetypes = {
    "json": "application/json",
-   "rdf":  "application/rdf+xml"
+   "rdf":  "application/rdf+xml",
+   "text": "text/plain"
 }
 
 def render(request, template_name, data_dict=None, content_type=None):

Modified: comdev/nearby_people/nearby/views.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/views.py?rev=1745876&r1=1745875&r2=1745876&view=diff
==============================================================================
--- comdev/nearby_people/nearby/views.py (original)
+++ comdev/nearby_people/nearby/views.py Sat May 28 14:13:14 2016
@@ -92,6 +92,9 @@ def retrieve_people_data(form):
    if form.data.get("type",None) == "sp":
       foaf = speakers_foaf
       people_type = "Speakers"
+   if form.data.get("type",None) == "all":
+      foaf = speakers_foaf # TODO All public
+      people_type = "Public Committers"
 
    search_data = form.data
    search_latitude = float(search_data["latitude"])
@@ -143,3 +146,7 @@ def find_people_json(request):
    "Old style JSON API, using a simple JSON dump"
    data = retrieve_people_data(LocationForm(request.GET))
    return HttpResponse(json_dump(data), mimetype=mimetypes["json"])
+
+def all_people(request):
+   "Map of all committers with public locations"
+   return HttpResponse("TODO", mimetype=mimetypes["text"])

Added: comdev/nearby_people/templates/map.html
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/map.html?rev=1745876&view=auto
==============================================================================
--- comdev/nearby_people/templates/map.html (added)
+++ comdev/nearby_people/templates/map.html Sat May 28 14:13:14 2016
@@ -0,0 +1,139 @@
+{% extends "base.html" %}
+{% load distances %}
+{% load emails %}
+
+{% block title %}- Public Committers{% endblock %}
+{% block heading %}Apache Public Committers{% endblock %}
+{% block bodyclass %}people{% endblock %}
+{% block extrahead %}
+
+<script type="text/javascript" src="http://www.google.com/jsapi?key={{gmaps_key}}"></script>
+<script type="text/javascript" charset="utf-8">
+    google.load("maps", "2.x");
+    google.load("jquery", "1.3.1");
+</script>
+
+<script type="text/javascript" charset="utf-8">
+<!--
+var markers = [];
+var map;
+
+$(document).ready(function(){
+	if (GBrowserIsCompatible()) {
+		map = new GMap2(document.getElementById('map'));
+		map.addControl(new GLargeMapControl());
+        map.setCenter(new GLatLng({{center_lat}}, {{center_long}}), 14);
+
+        // Zoom to roughly the right place
+        map.panTo(new GLatLng( {{center_lat}}, {{center_long}} ));
+        map.setZoom(
+             map.getBoundsZoomLevel(new GLatLngBounds(
+                    new GLatLng( {{bl_lat}} - 0.05, {{bl_long}} - 0.05 ),
+                    new GLatLng( {{tr_lat}} + 0.05, {{tr_long}} + 0.05 )
+             ))
+        );
+
+        // 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}}", projectNames,
+                         "{{person.avatar}}","{{person.email|emailformat}}");
+            map.addOverlay(marker);
+            markers["{{person.uid}}"] = marker;
+        {% endfor %}
+
+        // Add the search marker
+        search_icon = new GIcon(G_DEFAULT_ICON);
+        search_icon.image = "http://www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png";
+        search_icon.iconSize = GSize(32,32);
+        search_point = new GMarker(
+           new GLatLng({{location.latitude}},{{location.longitude}}),
+           search_icon, false
+        );
+        map.addOverlay(search_point);
+    }
+});
+
+function createMarker(name,lat,lng,link,projects,avatar,email) {
+	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 = "<h3>" + name + "</h3>";
+      if (avatar != "None") {
+          msg = msg + "<img src='" + avatar + "' alt='Image of " + name + "'/>"; 
+      }
+      msg = msg + " <ul>";
+      for (var i = 0; i < projects.length; i++) {
+    	  msg = msg + "<li>" + projects[i] + "</li>";
+    	};
+      msg = msg + " </ul>";
+      if (email != "None") {
+          msg = msg + "<div>Email: <i>" + email + "</i></div>";
+      }
+      msg = msg + " <a href=\"" + link + "\">" +
+                  "<small>Info<\/small><\/a>"; 
+      marker.openInfoWindowHtml(msg);
+    });
+	
+    return marker;
+}
+
+function showDetail(uid) {
+	if (map.getZoom() < 9) {
+      map.setZoom(9);
+	}
+	map.panTo(markers[uid].getPoint())
+    GEvent.trigger(markers[uid], "click");
+}
+
+//-->
+</script>
+<style type="text/css">
+#map {
+	border: 1px solid #bbbbbb;
+	height: 400px;
+	width: 80%;
+}
+
+	#map { float:left; width:500px; height:500px; }
+	#people { float:left; width:300px; background:#eee; list-style:none; padding:0; }
+	#people tr { padding:5px; }
+	#people tr:hover { background:#FFF; color:#ff;}
+</style>
+
+{% endblock %}
+{% block content %}
+
+<h1>TODO - Update this to match the old https://people.apache.org/map.html</h1>
+
+{% if people %}
+	{% if large_distance %}
+		<p>Sorry, there isn't anyone all that near to you. Below is a 
+		list of people you may wish to visit when travelling futher 
+		afield.</p>
+	{% endif %}
+
+	<table id="people">
+	  {% for dist, person in people %}
+		<tr>
+		  <td><a href="javascript:showDetail('{{person.uid}}')">{{person.name}}</a></td>
+		  <td>{{dist|distanceformat}}</td>
+		</tr>
+	  {% endfor %}
+	</table>
+
+	<div id="map"></div>
+	
+{% else %}
+	<p>Sorry, there's no-one near you :(</p>
+	<p>Maybe <a href="/pick_place/">try somewhere else?</a></p>
+	<p><i>Why not try searching for people near where you may be visiting
+     when on holiday, or next time you're travelling for work?</i></p>
+{% endif %}
+
+{% endblock %}

Modified: comdev/nearby_people/templates/welcome.html
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/welcome.html?rev=1745876&r1=1745875&r2=1745876&view=diff
==============================================================================
--- comdev/nearby_people/templates/welcome.html (original)
+++ comdev/nearby_people/templates/welcome.html Sat May 28 14:13:14 2016
@@ -10,6 +10,8 @@
  <li><b>Local Mentors</b> will return people willing to help 
    understand the ASF</li>
  <li><b>Speakers</b> will return people willing to speak at events</li>
+ <li><b>All Public Committers</b> will find any Apache Committer with
+   a public location. See also the <a href="/map/">all committers map</a></li>
 </ul>
 
 <form action="/pick_place/" method="post">
@@ -21,11 +23,14 @@
 
 <br /><br />
 
-<p>If you are an existing Apache committer, and you are willing to act as 
+<p>If you are an existing Apache Committer, and you are willing to act as 
  as a Local Mentor or Speaker, then please see 
  <a href="http://community.apache.org/localmentors.html">http://community.apache.org/localmentors.html</a>
  and
  <a href="http://community.apache.org/speakers/index.html">http://community.apache.org/speakers/index.html</a>
  for more information on what it would entail, and how to sign up.</p>
+<p>Any Apache Committers with good ideas on making it easier to sign up as a 
+ Local Mentor or Speaker is strongly encouraged to share them on
+ <a href="https://lists.apache.org/list.html?dev@community.apache.org">dev@community</a>!</p>
 
 {% endblock %}

Modified: comdev/nearby_people/urls.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/urls.py?rev=1745876&r1=1745875&r2=1745876&view=diff
==============================================================================
--- comdev/nearby_people/urls.py (original)
+++ comdev/nearby_people/urls.py Sat May 28 14:13:14 2016
@@ -33,6 +33,10 @@ urlpatterns = patterns('',
 	# Old style JSON support, not template based
 	(r'^find_people_json/$', 'nearby_people.nearby.views.find_people_json'),
 
+   # Replacement for https://people.apache.org/map.html
+	(r'^map/$',     'nearby_people.nearby.views.all_people'),
+	(r'^map.html$', 'nearby_people.nearby.views.all_people'),
+
     # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
     # to INSTALLED_APPS to enable admin documentation:
     # (r'^admin/doc/', include('django.contrib.admindocs.urls')),



Mime
View raw message