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