{% load maps leaflet_tags geojson_tags %}

{% leaflet_map mapname  fitextent=False %}
<script type="text/javascript">
function {{ mapname }}Init(map, bounds) {
    // Set map readonly
    map.dragging.disable();
    map.touchZoom.disable();
    map.doubleClickZoom.disable();
    map.scrollWheelZoom.disable();
    map.boxZoom.disable();
    map.removeControl(map.zoomControl);
    map.removeControl(map.attributionControl);
    
    // Add layers
    var geojson = {{ object|geojsonfeature|safe }};
    var objectLayer = new MapEntity.ObjectsLayer(geojson, {
        style: {weight: 5, opacity: 1, clickable: false}
    });
    map.addLayer(objectLayer);
    var objectBounds = {{ object|latlngbounds }},
        mapBounds = objectBounds ? new L.LatLngBounds(objectBounds) : bounds;
    map.fitBounds(mapBounds);
    map.addControl(new L.Control.Scale());
    
    // Paths layer (TODO: should we show objectsLayers ?)
    var pathsLayer = new MapEntity.ObjectsLayer(null, {
        style: {weight: 2, opacity: 0.7, clickable: false}
    });
    map.addLayer(pathsLayer);
    pathsLayer.load("{% url core:path_layer %}");
}
</script>

{% block extra %}{% endblock extra %}

{% load maps leaflet_tags geojson_tags %}

{% leaflet_map mapname  fitextent=False %}
<script type="text/javascript">
function {{ mapname }}Init(map, bounds) {
    {% if readonly %}
        // Set map readonly
        map.dragging.disable();
        map.touchZoom.disable();
        map.doubleClickZoom.disable();
        map.scrollWheelZoom.disable();
        map.boxZoom.disable();
    {% endif %}
    map.removeControl(map.zoomControl);
    map.removeControl(map.attributionControl);
    
    // Add layers
    var geojson = {{ object|geojsonfeature|safe }};
    var objectLayer = new MapEntity.ObjectsLayer(geojson, {
        style: {weight: 5, opacity: 1, clickable: false}
    });
    map.addLayer(objectLayer);
    var objectBounds = {{ object|latlngbounds }},
        mapBounds = objectBounds ? new L.LatLngBounds(objectBounds) : bounds;
    map.fitBounds(mapBounds);
    map.addControl(new L.Control.Scale());
    
    // Paths layer (TODO: should we show objectsLayers ?)
    var pathsLayer = new MapEntity.ObjectsLayer(null, {
        style: {weight: 2, opacity: 0.7, clickable: false}
    });
    map.addLayer(pathsLayer);
    pathsLayer.load("{% url core:path_layer %}");
}
</script>

{% block extra %}{% endblock extra %}

Allow pan and zoom on detail views
Allow pan and zoom on detail views
