index.html.twig 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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>Auteur</th>
  14. <th>Actions</th>
  15. </tr>
  16. </thead>
  17. <tbody>
  18. {% for article in articles %}
  19. {% if is_granted('edit', article) %}
  20. <tr>
  21. <td>{{ article.id }}</td>
  22. <td>{{ article.title }}</td>
  23. <td>{{ article.publicationDate ? article.publicationDate|date('Y-m-d H:i:s') : '' }}</td>
  24. <td><span class="badge badge-{{ article.state }}">{{ article.state | trans }}</span></td>
  25. <td>{{ article.author }}</td>
  26. <td>
  27. {% if is_granted('view', article) %}
  28. <a href="{{ path('app_article_show', {'id': article.id}) }}" class="btn btn-blue">Voir</a>
  29. {% endif %}
  30. {% if is_granted('edit', article) %}
  31. <a href="{{ path('app_article_edit', {'id': article.id}) }}" class="btn btn-blue">Editer</a>
  32. {% endif %}
  33. </td>
  34. </tr>
  35. {% endif %}
  36. {% else %}
  37. <tr>
  38. <td colspan="4">no records found</td>
  39. </tr>
  40. {% endfor %}
  41. </tbody>
  42. </table>
  43. <a class="btn btn-blue" href="{{ path('app_article_new') }}">Créer un nouvel article</a>
  44. </div>
  45. {{ include('article/_bouton_agrandir.html.twig') }}
  46. {% endblock %}