Commits

Steve Losh committed 5c6ea1d

MOAR WORK

Comments (0)

Files changed (2)

     trip = r.hgetall('trip:%s' % tid)
     if not trip:
         abort(404)
-    return render_template('trip.html', trip=trip)
+    
+    locs = [map(float, l.split(','))
+            for l in r.zrevrange('trip:%s:locs' % tid, 0, 1)]
+    current = locs[0]
+    return render_template('trip.html', trip=trip, current=current)
 
 
 @app.route('/api/trip/', methods=['POST'])

omw/templates/trip.html

     </style>
 
     <script type="text/javascript">
-      function initialize() {
-        var latlng = new google.maps.LatLng(-34.397, 150.644);
-        var myOptions = {
-          zoom: 8,
-          center: latlng,
-          mapTypeId: google.maps.MapTypeId.ROADMAP
-        };
-        var map = new google.maps.Map(document.getElementById("map_canvas"),
-            myOptions);
+        function initialize() {
+            var latlng = new google.maps.LatLng({{ current[0] }}, {{ current[1] }});
+            var myOptions = {
+                zoom: 15,
+                center: latlng,
+                mapTypeId: google.maps.MapTypeId.ROADMAP
+            };
+
+            var map = new google.maps.Map(document.getElementById("map_canvas"),
+                                          myOptions);
+
+            var marker = new google.maps.Marker({
+                position: latlng, 
+                map: map,
+                title: "Current position"
+            });
+            
       }
 
     </script>