Browse Source

Add URL to reference points, to allow moving from one panorama to another in the js interface

Baptiste Jonglez 9 years ago
parent
commit
a2212b335b

+ 1 - 0
panorama/models.py

@@ -176,6 +176,7 @@ class Panorama(ReferencePoint):
                      if self.great_circle_distance(refpoint) <= settings.PANORAMA_MAX_DISTANCE and refpoint.pk != self.pk]
         return enumerate([{"id": r.pk,
                            "name": r.name,
+                           "url": reverse('panorama:view_pano', args=[str(r.pk)]),
                            "cap": self.bearing(r),
                            "elevation": self.elevation(r),
                            "distance": self.line_distance(r) / 1000}

+ 1 - 1
panorama/static/panorama/js/pano.js

@@ -630,7 +630,7 @@ function tzoom(zv) {
 
 		    } else if(is_visible) {
 			    typ = 'pano_point';
-			    lnk += '&to_zoom='+this.value;
+			    lnk += '?to_zoom='+this.value;
 		    }
 		    this.pt_list[i]['type'] = typ;
 		    this.pt_list[i]['cap'] = cap;

+ 1 - 1
panorama/templates/panorama/view.html

@@ -28,7 +28,7 @@
       {% endfor %}
 
       {% for id, refpoint in panorama.refpoints_data %}
-      point_list[{{ id }}] = new Array("{{ refpoint.name }}", {{ refpoint.distance }}, {{ refpoint.cap }}, {{ refpoint.elevation }}, "", "/api/v1/refpoints/{{ refpoint.id }}/");
+      point_list[{{ id }}] = new Array("{{ refpoint.name }}", {{ refpoint.distance }}, {{ refpoint.cap }}, {{ refpoint.elevation }}, "{{ refpoint.url }}", "/api/v1/refpoints/{{ refpoint.id }}/");
       {% endfor %}
 
       ref_points = new Array();