{% extends 'core/layout.html' %}
{% load staticfiles %}

{% block css %}
    <link rel="stylesheet" href="{% static 'page.css' %}" />
    <link rel="stylesheet" href="{% static 'lib/leaflet/leaflet.css' %}" />
{% endblock %}

{% block js %}
    <script type="text/javascript" src="{% static 'lib/leaflet/leaflet.js' %}" ></script>
    <script type="text/javascript" src="{% static 'lib/OSMBuildings-Leaflet.js' %}"  ></script>
    <script type="text/javascript">
        var _static_url = {% static '' %}
        var _tiles_url = "{{tiles_url}}";
        var _tiles_opt = {{tiles_opt|safe}};
        var _default_view = {{default_view|safe}};

        var _lon = {{ place.lon|stringformat:"F" }};
        var _lat = {{ place.lat|stringformat:"F" }};
        var _polygon = {% if place.polygon %}{{place.polygon|safe}}{% else %}[]{% endif %};
    </script>
    <script type="text/javascript" src="{% static 'placemap.js' %}" ></script>
{% endblock %}

{% block content %}
    <div id="place-map"></div>

    <div class="container">
        <div class="row place">
            <div class="col-md-9">
                <h3>Betroffenes Gebiet</h3>
                <p>
                    <strong>Bezeichner:</strong> {{ place.identifier }}
                </p>
                <p>
                    <strong>genaue örtliche Beschreibung:</strong> {{ place.description }}
                </p>
                <p>
                    <strong>im Bezirk/in den Bezirken:</strong> {{ place.entities.all|join:", "}}
                </p>
            </div>
            {% if user.is_authenticated %}
            <div class="col-md-3">
                <ul class="list-unstyled admin-area" style="margin-top: 50px;">
                    <li><a class="admin-link" href="{{ place.get_update_url }}">Ort bearbeiten</a></li>
                    <li><a class="admin-link" href="{{ place.get_delete_url }}">Ort entfernen</a></li>
                    <li><a class="admin-link" href="{{new_publication_link}}?place_id={{place.pk}}">
                            Neue Veröffentlichung
                    </a></li>
                </ul>
            </div>
            {% endif %}
        </div>

        <h3>Veröffentlichungen zu diesem Gebiet</h3>

        {% include "process/place_publications.html" %}
    </div>

    <div class="comments-wrapper">
        <div class="container">
            <a class="comments-create" href="" data-toggle="modal" data-target="#comment-form">
                Eigenen Kommentar hinzufügen
            </a>

            <h3>Kommentare</h3>

            {% include "comments/list.html" %}

            {% include "comments/form.html" %}
        </div>
    </div>
{% endblock %}
