Parcourir la source

Merge branch 'rezine-style' of https://code.ffdn.org/FFDN/celutz into rezine-style

Samuel il y a 8 ans
Parent
commit
dff7fef7a4
3 fichiers modifiés avec 10 ajouts et 13 suppressions
  1. 1 0
      celutz/settings.py
  2. 7 13
      panorama/templates/panorama/locate_point.html
  3. 2 0
      panorama/views.py

+ 1 - 0
celutz/settings.py

@@ -43,6 +43,7 @@ INSTALLED_APPS = (
 
 MIDDLEWARE_CLASSES = (
     'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.locale.LocaleMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',

+ 7 - 13
panorama/templates/panorama/locate_point.html

@@ -65,23 +65,17 @@ style="padding:0px"
         var osmAttrib = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
         var osm = new L.TileLayer(osmUrl, {attribution: osmAttrib});
         // start the map in Grenoble
-//TODO : remplacer ce marqueur par celui du point recherché --> les variables point_lat et point_lat ne fonctionnent pas !
         map.setView(new L.LatLng(45.1842, 5.7218),13);
         map.addLayer(osm);
 
-        // Add in a crosshair for the map
-        var crosshairIcon = L.icon({
-            iconUrl: 'images/crosshair.png',
-            iconSize:     [20, 20], // size of the icon
-            iconAnchor:   [10, 10], // point of the icon which will correspond to marker's location
-        });
-        crosshair = new L.marker(map.getCenter(), {clickable:false});
-        crosshair.addTo(map);
-
-        // Move the crosshair to the center of the map when the user pans
-        map.on('move', function(e) {
-            crosshair.setLatLng(map.getCenter());
+        // Marker for the point being located
+        var locatedIcon = L.icon({
+            iconUrl: '{% static "panorama/img/marker-red.png" %}',
+            iconSize: [22, 35],
+            iconAnchor: [13, 42],
         });
+        located = new L.marker([{{ located_point_lat }}, {{ located_point_lon }}], {icon: locatedIcon});
+        located.addTo(map);
 
         map.on('moveend', function(e) {
             var lat = map.getCenter().lat;

+ 2 - 0
panorama/views.py

@@ -89,6 +89,8 @@ class LocateReferencePointView(MainView):
             point = form.cleaned_data['reference_point']
             context['located_panoramas'] = self.compute_interesting_panoramas(point)
             context['located_point_name'] = point.name
+            context['located_point_lat'] = point.latitude
+            context['located_point_lon'] = point.longitude
         return super(LocateReferencePointView, self).render_to_response(context)