{% extends "@ChillMain/layout.html.twig" %}

{% block title %}
    {{ 'news.title'|trans }}
{% endblock title %}

{% block css %}
    {{ parent() }}
    {{ encore_entry_link_tags('mod_news') }}
{% endblock %}

{% block content %}
    <div class="col-md-10 asideactivity-list">
        <h2>{{ 'news.title'|trans }}</h2>

        {{ filter_order|chill_render_filter_order_helper }}

        {% if entities|length == 0 %}
            <p class="chill-no-data-statement">
                {{ "news.no_data"|trans }}
            </p>
        {% else %}

            <div class="flex-table">

                {% for entity in entities %}

                    <div class="item-bloc">
                        <div class="item-row">
                            <div class="wrap-list">
                                <div class="wl-row">
                                    <div class="wl-col">
                                        <h2>{{ entity.title }}</h2>
                                    </div>
                                    <div class="wl-col">
                                        <p>
                                            {% if entity.startDate %}
                                                <span>{{ entity.startDate|format_date('long') }}</span>
                                            {% endif %}
                                            {% if entity.endDate %}
                                                <span> - {{ entity.endDate|format_date('long') }}</span>
                                            {% endif %}
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="item-row separator">
                            <div>
                                {{ entity.content|u.truncate(350, '…', false)|chill_markdown_to_html }}
                            </div>
                        </div>
                        {% if entity.content|length > 350 %}
                        <div class="item-row">
                            <ul class="record_actions">
                                <li>
                                    <a href="{{ chill_path_add_return_path('chill_main_single_news_item', { 'id': entity.id } ) }}" class="btn btn-show btn-sm read-more">{{ 'news.read_more'|trans }}</a>
                                </li>
                            </ul>
                        </div>
                        {% endif %}
                    </div>
                {% endfor %}
            </div>

            {{ chill_pagination(paginator) }}
        {% endif %}
    </div>
{% endblock %}
