<div class="fluid-grid"
js-algolia-list="{type: '{{ type }}', userConnected: '{{ app.user == null ? 'false' : 'true' }}' , isAdherent: '{{ page.type == 'publications-list-adherent' }}' }">
{# header list #}
{# {% set typeClass = type == 'publication' ? 'publi' : 'news' %} #}
{% if type == 'publication' %}
{% set typeClass = 'publi' %}
{% elseif type == 'news' %}
{% set typeClass = 'news' %}
{% else %}
{% set typeClass = 'photo' %}
{% endif %}
<div class="{{ page.type != 'publications-list-adherent' ? 'card-list-heading card-list-heading--' ~ typeClass : 'mb-8' }}">
<div class="{{ page.template != 'photo-library' ? 'row' : 'md:flex' }} justify-between items-end">
<div class="{{ page.template != 'photo-library' ? 'col-12 md-col-8 lg-col-9' : '' }} mb-4 md:mb-0">
{% if page.template != 'photo-library' %}
<h2 class="title title--L {{ page.type != 'publications-list-adherent' ? 'text-white' : 'text-violet-dark' }} font-light">
{% else %}
<h2 class="title title--L title--stats text-violet-dark font-light">
{% endif %}
{% if page.type == 'publications-list-adherent' %}
Nos dernières <span>publications adhérentes</span>
{% elseif page.type == 'photo-library' %}
<div js-algolia-list-stats></div>
{% else %}
Toutes nos <span>{{ type == 'publication' ? 'publications' : 'actualités' }}</span>
{% endif %}
</h2>
</div>
<div class="{{ page.template != 'photo-library' ? 'col-12 md-col-4 lg-col-3' : '' }}">
{% if page.type == 'photo-library' %}
<button class="filters-toggle" js-modal-control="{target: '#filters-list'}">
Filtrer par typologie de photos
<svg width="13" height="8" class="icon--violet ml-2">
<use href="#icon-arrow-down" xlink:href="#icon-arrow-down"></use>
</svg>
</button>
{% else %}
<button class="filters-toggle" js-modal-control="{target: '#filters-list'}">
Filtrer les {{ type == 'publication' ? 'publications' : 'actualités' }}
<svg width="13" height="8" class="icon--violet">
<use href="#icon-arrow-down" xlink:href="#icon-arrow-down"></use>
</svg>
</button>
{% endif %}
{% include 'front/partials/modal/filters.html.twig' %}
</div>
</div>
</div>
{# results list #}
<div class="card-list" js-algolia-list-results>
{% set tag = null %}
{% if page.type == 'expertise' and page.tags|length > 0 %}
{% set tag = page.tags[0] %}
{% endif %}
{% if publications is defined %}
{% for publication in publications %}
{% if page.type == 'publications-list' %}
{% set publicationProperties = publication.contentProperties %}
{% include 'front/partials/cards/publication.html.twig' with {type: publication.type} %}
{% elseif page.type == 'news-list' %}
{% set news = publication %}
{% set newsProperties = news.contentProperties %}
{% include 'front/partials/cards/news-event.html.twig' with {type: news.type} %}
{% elseif page.type == 'photo-library' %}
{% set photo = publication %}
{% set photoProperties = photo.contentProperties %}
{% include 'front/partials/cards/photo.html.twig' with {type: photo.type} %}
{% endif %}
{% endfor %}
{% endif %}
</div>
<div js-algolia-list-pagination>
{% set offset = app.request.query.get("page") ?? 1 %}
{% if pagination is defined and pagination.totalPages is defined and pagination.totalPages > 1 %}
<ul>
<li>
{% if app.request.query.get("sort") %}
{% set param = {page: app.request.query.get("page") - 1|default(), sort: app.request.query.get("sort")|default('desc')} %}
{% else %}
{% set param = {page: app.request.query.get("page") - 1|default()} %}
{% endif %}
<a href="{{ page_url(page.type, "front", param) }}"></a>
</li>
{% for i in 1..pagination.totalPages %}
{% if app.request.query.get("sort") %}
{% set param = {page: i, sort: app.request.query.get("sort")|default('desc')} %}
{% else %}
{% set param = {page: i} %}
{% endif %}
<li>
<a href="{{ page_url(page.type, "front", param) }}"></a>
</li>
{% endfor %}
{% if app.request.query.get("sort") %}
{% set param = {page: offset + 1, sort: app.request.query.get("sort")|default('desc')} %}
{% else %}
{% set param = {page: offset + 1} %}
{% endif %}
<li>
<a href="{{ page_url(page.type, "front", param) }}"></a>
</li>
</ul>
{% endif %}
</div>
</div>