list.html.twig 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {% extends 'base.html.twig' %}
  2. {% block body %}
  3. <div class="row">
  4. <div class="col-md-12">
  5. <table class="table table-striped table-hover table-references">
  6. <thead>
  7. <tr>
  8. <th>Type</th>
  9. <th>Id</th>
  10. <th>Authority</th>
  11. <th>Title</th>
  12. <th>Issued</th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. {% for reference in references %}
  17. <tr data-url="{{ path('edit', {'id': reference.id|escape('url')}) }}">
  18. <td>{{ reference.type }}</td>
  19. <td>{{ reference.id }}</td>
  20. <td>{{ reference.authority }}</td>
  21. <td>{{ reference.title }}</td>
  22. <td class="date-field">{{ reference.issued|localizeddate('medium', 'none') }}</td>
  23. </tr>
  24. {% endfor %}
  25. </tbody>
  26. </table>
  27. </div>
  28. <div class="col-md-12">
  29. <a href="{{ path('create') }}" class="btn btn-success">Créer</a>
  30. <a href="{{ path('list', {'_format': 'yml'}) }}" class="btn btn-default">Télécharger references.yml</a>
  31. </div>
  32. </div>
  33. {% endblock %}
  34. {% block javascripts %}
  35. <script type="text/javascript">
  36. $(document).ready( function () {
  37. $('.table-references').DataTable({
  38. drawCallback: function () {
  39. $('.table-references tbody tr').on('click', function() {
  40. window.location = $(this).data('url');
  41. });
  42. }
  43. });
  44. } );
  45. </script>
  46. {% endblock %}