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

{% load unicms_contexts %}

{% call obj=publication method='url' webpath=webpath as url %}


<div class="card-wrapper card-space">
    <div class="card card-bg no-after">
        <div class="card-body ps-0">
            <div class="row">
                <div class="col-6">
                    {% if url %}
                    <a href="{{ url }}">
                    {% endif %}
                        <img src="{{ publication.image_url }}"
                             title="{{ publication.image_title }}"
                             alt="{{ publication.image_description }}"
                             class="w-100"
                             loading="lazy">
                    {% if url %}
                    </a>
                    {% endif %}
                </div>
                <div class="col-6">
                    {% block card_labels %}
                    <div class="etichetta">
                        {% for cat in publication.categories %}
                        <span class="badge rounded-pill badge-grey-unical my-1 py-2 px-4 me-1">
                            <a class="no-color" href="{% call obj=publication method='get_url_list' category_name=cat.name %}">
                                <b>{{ cat.name }}</b>
                            </a>
                        </span>
                        {% endfor %}
                    </div>
                    {% endblock card_labels %}

                    {% include "includes/edit_page_publication.html" with item=page_publication %}

                    {% if url %}
                    <a class="no-color" href="{{ url }}">
                    {% endif %}
                        <h4 class="card-title">
                            {{ publication.title }}
                        </h4>
                    {% if url %}
                    </a>
                    {% endif %}

                    {% block card_content %}
                    {% if publication.subheading %}
                    <p class="card-text">
                        {{ publication.subheading|truncatechars:50 }}
                    </p>
                    {% endif %}
                    {% endblock card_content %}

                    {% if url %}
                    {% include "includes/social_share.html" with share_title=item.publication.title share_url=request.get_host|add:url %}
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>

