index.html.twig 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Gestion des articles{% endblock %}
  3. {% block body %}
  4. <div>
  5. <h1>gestion des articles</h1>
  6. <table class="table-articles">
  7. <thead>
  8. <tr>
  9. <th>Id</th>
  10. <th>Titre</th>
  11. <th>Date de publication</th>
  12. <th>Etat</th>
  13. <th>Actions</th>
  14. </tr>
  15. </thead>
  16. <tbody>
  17. {% for article in articles %}
  18. {% if is_granted('edit', article) %}
  19. <tr>
  20. <td>{{ article.id }}</td>
  21. <td>{{ article.title }}</td>
  22. <td>{{ article.publicationDate ? article.publicationDate|date('Y-m-d H:i:s') : '' }}</td>
  23. <td><span class="badge badge-{{ article.state }}">{{ article.state | trans }}</span></td>
  24. <td>
  25. {% if is_granted('view', article) %}
  26. <a href="{{ path('app_article_show', {'id': article.id}) }}" class="btn btn-blue">Voir</a>
  27. {% endif %}
  28. {% if is_granted('edit', article) %}
  29. <a href="{{ path('app_article_edit', {'id': article.id}) }}" class="btn btn-blue">Editer</a>
  30. {% endif %}
  31. </td>
  32. </tr>
  33. {% endif %}
  34. {% else %}
  35. <tr>
  36. <td colspan="4">no records found</td>
  37. </tr>
  38. {% endfor %}
  39. </tbody>
  40. </table>
  41. <a class="btn btn-blue" href="{{ path('app_article_new') }}">Créer un nouvel article</a>
  42. </div>
  43. {{ include('article/_bouton_agrandir.html.twig') }}
  44. {% endblock %}