{% extends "orgapy/layout/fullscreen.html" %}
{% load static %}

{% block title %}{% if document.title %}{{document.title}}{% else %}Untitled{% endif %}{% endblock title %}

{% block head %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'orgapy/dependencies/leaflet.css' %}" />
<link rel="stylesheet" href="{% static 'orgapy/css/maps.css' %}" />
<script src="{% static 'orgapy/dependencies/leaflet.js' %}"></script>
<script src="{% static 'orgapy/dependencies/Leaflet.Editable.js' %}"></script>
<script src="{% static 'orgapy/dependencies/Path.Drag.js' %}"></script>
<script src="{% static 'orgapy/js/maps.js' %}"></script>
{% endblock head %}

{% block column_main %}

<div class="map-layout {% if request.GET.embed %}embedded{% endif %}" map-nonce="{{document.nonce}}">
    <div class="map-dashboard"></div>
    <div class="map-seed"></div>
</div>

{% if not readonly and document.referenced_in %}
<template id="template-refs">
    <div class="map-refs row">
        {% for ref in document.referenced_in.all %}
        <a class="reference label" href="{% url 'orgapy:document' ref.nonce %}"><i class="ri-links-line"></i> {{ ref.title }}</a>
        {% endfor %}
    </div>
</template>
{% endif %}
<script>initializeMaps({% if readonly %}true{% else %}false{% endif %})</script>
{% endblock %}