{% load i18n %}
{% load static %}


<h1 class="mb-4">{{ publication.title }}</h1>

{% if publication.subheading %}
<div class="bigger-font mb-4">{{ publication.subheading }}</div>
{% endif %}

{% if publication.presentation_image %}
<div class="mb-4">
    <img src="{{ publication.image_url }}"
         title="{{ publication.presentation_image.title }}"
         alt="{{ publication.presentation_image.description }}"
         class="w-100">
</div>
{% endif %}

{% if publication.html_content %}
<div>
    {{ publication.html_content|safe }}
</div>
{% endif %}

{% if publication.get_attachments %}
<hr class="my-4">
<h4>{% trans "attachments" %}</h4>

<!-- ATTACHMENTS -->
<ul class="upload-file-list" style="list-style: none">
    {% for item in publication.get_attachments %}
    <li>
        <a href="{{ item.file.url }}" >
            <svg class="icon icon-secondary"
                 aria-hidden="true">
                <use xlink:href="{% static '/svg/sprite.svg' %}#it-file"></use>
            </svg>
            <span class="sr-only">{% trans "Attachment" %}:</span> {{ item.name }}
            <span class="text-muted small">
                &nbsp; {{ item.file_type }} ({{ item.file_size_kb }} KB)
            </span>
        </a>
    </li>
    {% endfor %}
</ul>
<!-- END ATTACHMENTS -->
{% endif %}

{% if publication.related_links %}
<hr class="my-4">
<h4>{% trans "Links" %}</h4>
<ul class="pl-0" style="list-style: none">
{% for link in publication.related_links %}
    <li class="mb-3">
        <a href="{{ link.url }}">
            <svg class="icon icon-xs">
                <use xlink:href="{% static 'svg/sprite.svg' %}#it-link"></use>
            </svg>
            {{ link.name }}
        </a>
    </li>
{% endfor %}
</ul>
{% endif %}

{% if publication.related_galleries %}
<hr class="my-4">
<h4>{% trans "Photo galleries" %}</h4>
    {% for gallery in publication.related_galleries %}
        {% include "carousel_media_gallery.html" with media_items=gallery.collection.get_items %}
    {% endfor %}
{% endif %}

{% if publication.tags.all %}
<hr class="my-4">
<h4>{% trans "tags" %}</h4>
<p style="font-size: 1.2rem">
    {% for tag in publication.tags.all %}
        <span class="badge badge-grey-unical square-corners">{{ tag.name }}</span>
    {% endfor %}
</p>
{% endif %}
<!-- END PUBLICATION BODY -->
