{% if object_list %}
{% for place in object_list %}
-
+
- Adresse : {% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}
- Coordonnée GPS : {{ place.location }}
@@ -61,13 +58,17 @@
maxZoom: 19,
attribution: '© OpenStreetMap'
}).addTo(map);
- var markerArray = [];
+ markerArray = [];
+ window.mMapping = {};
{% if object_list %}
{% for place in object_list %}
markerArray.push(L.marker([{{ place.location }}]).bindPopup('{{ place.name }}
{% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}'));
+ window.mMapping[{{ place.id }}] = markerArray[markerArray.length - 1];
+ window.jQuery('a#open-map-{{ place.id }}').click(function(){ window.mMapping[{{ place.id }}].openPopup();});
{% endfor %}
{% endif %}
- var group = L.featureGroup(markerArray).addTo(map);
+ var group = L.featureGroup(window.markerArray).addTo(map);
map.fitBounds(group.getBounds());
+
{% endblock %}
\ No newline at end of file