templates/front/partials/card-list.html.twig line 1

Open in your IDE?
  1. <div class="fluid-grid"
  2.      js-algolia-list="{type: '{{ type }}', userConnected: '{{ app.user == null ? 'false' : 'true' }}' , isAdherent: '{{ page.type == 'publications-list-adherent' }}' }">
  3.     {# header list #}
  4.     {# {% set typeClass = type == 'publication' ? 'publi' : 'news' %} #}
  5.     {% if type == 'publication' %}
  6.         {% set typeClass = 'publi' %}
  7.     {% elseif type == 'news' %}
  8.         {% set typeClass = 'news' %}
  9.     {% else %}
  10.         {% set typeClass = 'photo' %}
  11.     {% endif %}
  12.     <div class="{{ page.type != 'publications-list-adherent' ? 'card-list-heading card-list-heading--' ~ typeClass : 'mb-8' }}">
  13.         <div class="{{ page.template != 'photo-library' ? 'row' : 'md:flex' }} justify-between items-end">
  14.             <div class="{{ page.template != 'photo-library' ? 'col-12 md-col-8 lg-col-9' : '' }} mb-4 md:mb-0">
  15.                 {% if page.template != 'photo-library' %}
  16.                 <h2 class="title title--L {{ page.type != 'publications-list-adherent' ? 'text-white' : 'text-violet-dark' }} font-light">
  17.                 {% else %}
  18.                 <h2 class="title title--L title--stats text-violet-dark font-light">
  19.                 {% endif %}
  20.                     {% if page.type == 'publications-list-adherent' %}
  21.                         Nos dernières <span>publications adhérentes</span>
  22.                     {% elseif page.type == 'photo-library' %}
  23.                         <div js-algolia-list-stats></div>
  24.                     {% else %}
  25.                         Toutes nos <span>{{ type == 'publication' ? 'publications' : 'actualités' }}</span>
  26.                     {% endif %}
  27.                 </h2>
  28.             </div>
  29.             <div class="{{ page.template != 'photo-library' ? 'col-12 md-col-4 lg-col-3' : '' }}">
  30.                 {% if page.type == 'photo-library' %}
  31.                 <button class="filters-toggle" js-modal-control="{target: '#filters-list'}">
  32.                     Filtrer par typologie de photos
  33.                     <svg width="13" height="8" class="icon--violet ml-2">
  34.                         <use href="#icon-arrow-down" xlink:href="#icon-arrow-down"></use>
  35.                     </svg>
  36.                 </button>
  37.                 {% else %}
  38.                 <button class="filters-toggle" js-modal-control="{target: '#filters-list'}">
  39.                     Filtrer les {{ type == 'publication' ? 'publications' : 'actualités' }}
  40.                     <svg width="13" height="8" class="icon--violet">
  41.                         <use href="#icon-arrow-down" xlink:href="#icon-arrow-down"></use>
  42.                     </svg>
  43.                 </button>
  44.                 {% endif %}
  45.                 {% include 'front/partials/modal/filters.html.twig' %}
  46.             </div>
  47.         </div>
  48.     </div>
  49.     {# results list #}
  50.     <div class="card-list" js-algolia-list-results>
  51.         {% set tag = null %}
  52.         {% if page.type == 'expertise' and page.tags|length > 0 %}
  53.             {% set tag = page.tags[0] %}
  54.         {% endif %}
  55.         {% if publications is defined %}
  56.             {% for publication in publications %}
  57.                 {% if page.type == 'publications-list' %}
  58.                     {% set publicationProperties = publication.contentProperties %}
  59.                     {% include 'front/partials/cards/publication.html.twig' with {type: publication.type} %}
  60.                 {% elseif page.type == 'news-list' %}
  61.                     {% set news = publication %}
  62.                     {% set newsProperties = news.contentProperties %}
  63.                     {% include 'front/partials/cards/news-event.html.twig' with {type: news.type} %}
  64.                 {% elseif page.type == 'photo-library' %}
  65.                     {% set photo = publication %}
  66.                     {% set photoProperties = photo.contentProperties %}
  67.                     {% include 'front/partials/cards/photo.html.twig' with {type: photo.type} %}
  68.                 {% endif %}
  69.             {% endfor %}
  70.         {% endif %}
  71.     </div>
  72.     <div js-algolia-list-pagination>
  73.         {% set offset = app.request.query.get("page") ?? 1 %}
  74.         {% if pagination is defined and  pagination.totalPages is defined and pagination.totalPages > 1 %}
  75.             <ul>
  76.                 <li>
  77.                     {% if app.request.query.get("sort") %}
  78.                         {% set param = {page: app.request.query.get("page") - 1|default(), sort: app.request.query.get("sort")|default('desc')} %}
  79.                     {% else %}
  80.                         {% set param = {page: app.request.query.get("page") - 1|default()} %}
  81.                     {% endif %}
  82.                     <a href="{{ page_url(page.type, "front", param) }}"></a>
  83.                 </li>
  84.                 {% for i in 1..pagination.totalPages %}
  85.                     {% if app.request.query.get("sort") %}
  86.                         {% set param = {page: i, sort: app.request.query.get("sort")|default('desc')} %}
  87.                     {% else %}
  88.                         {% set param = {page: i} %}
  89.                     {% endif %}
  90.                     <li>
  91.                         <a href="{{ page_url(page.type, "front", param) }}"></a>
  92.                     </li>
  93.                 {% endfor %}
  94.                 {% if app.request.query.get("sort") %}
  95.                     {% set param = {page: offset + 1, sort: app.request.query.get("sort")|default('desc')} %}
  96.                 {% else %}
  97.                     {% set param = {page: offset + 1} %}
  98.                 {% endif %}
  99.                 <li>
  100.                     <a href="{{ page_url(page.type, "front", param) }}"></a>
  101.                 </li>
  102.             </ul>
  103.         {% endif %}
  104.     </div>
  105. </div>