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

{% load unicms_contexts %}
{% load unicms_menus %}
{% load unicms_template_unical %}


{% load_current_item_from_menu as current_item %}

{% block item_publication %}
{% if current_item.publication %}
{% load_item_publication current_item as publication %}
{% include "unical_publication_full_view.html" with publication=publication %}
<hr class="mb-5" />
{% endif %}
{% endblock item_publication %}

{% load_item_childs current_item as childs %}

{% for item in childs %}

{% call obj=item method='link' request=request as link %}
{% load_item_inherited_content item as publication %}

<div class="row mb-4">

    {% if publication.image_url %}
    <div class="col-12 col-lg-3 mt-lg-2 mb-3 mb-lg-0 text-start text-lg-center">
        <a href="{{ link }}">
            <img src="{{ publication.image_url }}"
                 title="{{ publication.image_title }}"
                 alt="{{ publication.image_description }}"
                 class="mw-100" style="max-height: 150px"
                 loading="lazy">
        </a>
    </div>
    {% endif %}

    <div class="col ps-lg-4">
        <h3>
            <a href="{{ link }}" class="no-color">
                {{ item.name }}
            </a>
        </h3>

        {{ publication.subheading }}

        {% if item.get_childs %}

        {% load_item_childs item as childs %}

        <div class="row mt-3">
            <div class="col">
            {% for child in childs %}
                {% call obj=child method='link' request=request as child_link %}
                {% if child_link %}
                <span
                    class="badge badge-grey-unical square-corners mb-3 me-3 ms-0 pe-5 p-2 mw-100"
                    style="font-size: 100%">
                    <a class="no-color" href="{{ child_link }}">
                        <b>{{ child.name }}</b>
                    </a>
                </span>
                {% endif %}
            {% endfor %}
            </div>
        </div>
        {% endif %}
    </div>
</div>
{% if not forloop.last %}
<hr class="my-4" style="color: var(--bordeaux_unical)">
{% endif %}
{% endfor %}


