{% extends 'partials/base.html.twig' %}

{% block content %}
  <div class="content" id="projets-index" data-barba="container" data-barba-namespace="projetsindex">

    <div id="filter-index">
      <p>Consulter les projets d'utilité</p>
      <p>
        <span id="publique-filter" class="filter-button" onClick="filterCards('publique')">publique</span>,
        <span id="sociale-filter" class="filter-button" onClick="filterCards('sociale')">sociale</span>,
        <span id="culturelle-filter" class="filter-button" onClick="filterCards('culturelle')">culturelle</span>
      </p>
    </div>

    <hr>

    {% for category in taxonomylist.get().category|keys %}

    <div class="title-category" onclick="toggleCategory(this)">
      <h2>
        {{ category }}
      </h2>
      <div class="picto chevron-category" data-src="{{ url('theme://images/pictos/chevron-down.svg') }}" aria-hidden="true"></div>
    </div>

      {% set cat = { items: {'@taxonomy': {'category': category} } } %}
      {% set pages = page.collection(cat) %}

      <div class="projets-grid">
        {% for p in pages.order('date', 'desc') %}
          {% block project_card %}
            {% include 'partials/projet_card.html.twig' %}
          {% endblock %}
        {% endfor %}
      </div>

    {% endfor %}
  </div>
{% endblock %}
