David Mazary avatar David Mazary committed 7d51690

Put psuedocode for generating map markers in template and form.

Comments (0)

Files changed (2)

geolocator/forms.py

 	)
 	term = forms.CharField()
 	filter_type = forms.ChoiceField(initial = 'displayName', choices = FILTER_CHOICES)
+
+	results = []
+	# TODO For each result in model, do the following:
+	results.append(r"""latlng = new google.maps.LatLng(37.216195,-80.449069);
+        contentString = '<div id="info">'+
+            '<div id="siteNotice">'+
+            '</div>'+
+            '<h1 id="firstHeading" class="firstHeading">displayName</h1>'+
+            '<div id="bodyContent">'+
+            '<p>localPostalAddress</p>'+
+            '<p>localPhone or phone</p>'+
+            '<p>email: uupid@vt.edu</p>'+
+            '<p>Major: major</p>'+
+            '</div>'+
+            '</div>';
+
+        infowindow = new google.maps.InfoWindow({
+            content: contentString
+        });
+        marker = new google.maps.Marker({
+            position: latlng,
+            title: "displayName here"
+        });
+        google.maps.event.addListener(marker, 'click', function() {
+            infowindow.open(map,marker);
+        });
+        marker.setMap(map);""")

resources/templates/index.html

   </script>
   <script type="text/javascript">
     function initialize() {
-      var latlng = new google.maps.LatLng(37.229573, -80.413939);
-      var myOptions = {
-        zoom: 13,
-        center: latlng,
-        mapTypeId: google.maps.MapTypeId.SATELLITE
-      };
-      var map = new google.maps.Map(document.getElementById("map_canvas"),
-          myOptions);
+        var latlng = new google.maps.LatLng(37.229573, -80.413939);
+        var myOptions = {
+            zoom: 13,
+            center: latlng,
+            mapTypeId: google.maps.MapTypeId.SATELLITE
+        };
+        var map = new google.maps.Map(document.getElementById("map_canvas"),
+            myOptions);
 
-      latlng = new google.maps.LatLng(37.216195,-80.449069);
-      var contentString = '<div id="info">'+
-    '<div id="siteNotice">'+
-    '</div>'+
-    '<h1 id="firstHeading" class="firstHeading">David Mazary</h1>'+
-    '<div id="bodyContent">'+
-    '<p>540-726-5075</p>'+
-    '<p>PID: dmaz</p>'+
-    '<p>Major: Computer Science</p>'+
-    '</div>'+
-    '</div>';
-
-var infowindow = new google.maps.InfoWindow({
-    content: contentString
-});
-      var marker = new google.maps.Marker({
-          position: latlng,
-          title:"5700 Heather Dr."
-      });
-      google.maps.event.addListener(marker, 'click', function() {
-  infowindow.open(map,marker);
-});
-      marker.setMap(map);
+        {% if form.results %}
+        var contentString, infowindow, marker;
+        {{ form.results }}
+        {% endif %}
     }
   </script>
 {% endblock %}
 
 {% block auth_status %}
-  	<div id="auth_status">
-	    {% if user.is_authenticated %}<span id="username">{{ user.username }}</span> | <a href="/friends/">Friends</a> | <a href="/accounts/logout/">Log out</a>
-	    {% else %}
-      	<a href="/accounts/login/">Log in</a> | <a href="/accounts/add/">Register</a>
-	    {% endif %}
+      <div id="auth_status">
+        {% if user.is_authenticated %}<span id="username">{{ user.username }}</span> | <a href="/friends/">Friends</a> | <a href="/accounts/logout/">Log out</a>
+        {% else %}
+          <a href="/accounts/login/">Log in</a> | <a href="/accounts/add/">Register</a>
+        {% endif %}
     </div>
 {% endblock %}
 
             <li><input type="submit" value="Search"></li>
         </ul>
     </form>
+    {% if form.results %}
+        <div id="results">
+            <b>{{form.filter_type}}: {{form.term}}</b> {{form.results.count}} person{{form.results|pluralize}}
+        </div><button>Show 10 more</button>
+    {% endif %}
 {% endblock %}
 
 {% block map %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.