templates/model/echange.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Echanges{% endblock %}
  3. {% block body %}
  4. <div style="width: 100%;">
  5.         <section class='topPageCollection'>
  6. {#            <div class="firstPart">#}
  7. {#                <h3 class="lists-title">Echange.</h3>#}
  8. {#            </div>#}
  9.             <div class="subtitleCollection">
  10.                 <span class="mt-5 echange">Ici sont répertoriés les écussons disponibles à l'échange.<br>Vous êtes interessé par un modèle ?<br>
  11.                     Contactez-moi <a href="mailto:michelin.david01@gmail.com">ici</a>
  12.                     </span>
  13.                 <p>Nombre total de modèles à l'échange : {{ count }}</p>
  14.             </div>
  15.             <div class="converter-list">
  16.                 <button id="list-button">
  17.                     <i class="fa-solid fa-list"></i>
  18.                 </button>
  19.                 <button id="grid-button">
  20.                     <i class="fa-solid fa-table-cells-large"></i>
  21.                 </button>
  22.             </div>
  23.         </section>
  24.         <div class="row block grid-collection grid-top-margin" id="content-collection">
  25.             {% for model in models %}
  26.                 <div class="card">
  27.                     {% if model.photos is empty %}
  28.                         <img src="/images/logo_ecusson_bleu_grand_format.png" class="img-fluid rounded- ">
  29.                     {% else %}
  30.                         <img src="{{ model.photos[0].chemin }}" class="img-fluid rounded- ">
  31.                     {% endif %}
  32.                     <h5>{{ model.titre }}</h5>
  33.                     {% if 'ROLE_ADMIN' in app.user.roles %}
  34.                         <span class="qty">x{{ model.nb > 10 ? model.nb -1 : '0'~model.nb -1 }}</span>
  35.                     {% else %}
  36.                         <br>
  37.                     {% endif %}
  38.                     <div class="card-body">
  39.                         <ul>
  40.                             <li class="title-category">Catégories :</li>
  41.                             {% for categorie in model.categories %}
  42.                                 <li>
  43.                                     {{ categorie.nom }}
  44.                                 </li>
  45.                             {% endfor %}
  46.                         </ul>
  47.                     </div>
  48.                     <div class="bottom-card">
  49.                         <a href="{{ path('app_model_show', {'id':model.id}) }}" class="btn btn-round btn-grad container-fluid ">En savoir plus</a>
  50.                     </div>
  51.                 </div>
  52.             {% endfor %}
  53.         </div>
  54. </div>
  55. {% endblock %}
  56. {% block javascripts %}
  57.     {{ encore_entry_script_tags('app') }}
  58.     <script>
  59.         let listButton = document.getElementById('list-button')
  60.         let gridButton = document.getElementById('grid-button')
  61.         let contentCollection = document.getElementById('content-collection')
  62.         gridButton.classList.add('active');
  63.         listButton.addEventListener('click', () => {
  64.             contentCollection.classList.remove('grid-collection');
  65.             contentCollection.classList.add('list-collection');
  66.             listButton.classList.add('active');
  67.             gridButton.classList.remove('active')
  68.         });
  69.         gridButton.addEventListener('click', () => {
  70.             contentCollection.classList.remove('list-collection');
  71.             contentCollection.classList.add('grid-collection');
  72.             gridButton.classList.add('active');
  73.             listButton.classList.remove('active')
  74.         });
  75.     </script>
  76. {% endblock %}