agenda_culturel/src/agenda_culturel/templates/agenda_culturel/place_detail.html

79 lines
2.9 KiB
HTML

{% extends "agenda_culturel/page.html" %}
{% block title %}#{{ object.name }}{% endblock %}
{% load tag_extra %}
{% load utils_extra %}
{% load cat_extra %}
{% load static %}
{% block entete_header %}
{% css_categories %}
<script src="/static/admin/js/vendor/jquery/jquery.js"></script>
<script src="/static/admin/js/jquery.init.js"></script>
<script src="{% static 'location_field/leaflet/leaflet.js' %}"></script>
<link href="{% static 'location_field/leaflet/leaflet.css' %}" type="text/css" media="all" rel="stylesheet">
{% endblock %}
{% block fluid %}{% endblock %}
{% block content %}
<article>
<header>
{% if perms.agenda_culturel.change_place %}
<a href="{% url 'view_places' %}" role="button">&lt; Tous les lieux</a>
{% endif %}
{% if perms.agenda_culturel.change_place %}
<div class="slide-buttons">
<a href="{% url 'edit_place' place.pk %}" role="button">Modifier {% picto_from_name "edit-3" %}</a>
<a href="{% url 'delete_place' place.pk %}" role="button">Supprimer {% picto_from_name "trash-2" %}</a>
</div>
{% endif %}
<h1>{{ object.name }}</h1>
</header>
<div class="grid">
<div>
<ul>
<li><strong>Adresse&nbsp;:</strong> {{ object.address }}, {{ object.city }}</li>
<li><strong>Coordonnée GPS&nbsp;:</strong> <a href="geo:{{ object.location }}">{{ object.location }}</a></li>
{% if object.nb_events > 0 %}
<li><strong>Nombre d'événements&nbsp;:</strong> {{ object.nb_events }}</li>
{% else %}
<li><em>Aucun événement n'est enregistré dans ce lieu</em></li>
{% endif %}
</ul>
</div>
<div>
<div id="map_location" style="width: 100%; aspect-ratio: 16/16"></div>
<script>
L.Icon.Default.imagePath = "{% static "location_field/leaflet/images/" %}";
var map = L.map('map_location').setView([{{ object.location }}], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var marker = L.marker([{{ object.location }}]).addTo(map);
</script>
</div>
</div>
<footer>
<!--p>Voir tous les événements de ce lieu</p-->
{% if user.is_authenticated %}
{% if object.aliases|length > 0 %}
<p>Alias associés à ce lieu&nbsp;:</p>
<ul>
{% for alias in object.aliases %}
<li>{{ alias }}</li>
{% endfor %}
</ul>
{% else %}
<p><em>Ce lieu n'a pas d'alias défini</em></p>
{% endif %}
{% endif %}
</footer>
</article>
{% endblock %}