base_list.twig 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. <h1>{% block title %}{% trans 'title_list' from 'BaseApplicationBundle'%}{% endblock %}</h1>
  8. {% block actions %}
  9. <div>
  10. <ul>
  11. <li><a href="{{ url(urls.create.url) }}">{% trans "link_action_create" from "BaseApplicationBundle" %}</a></li>
  12. </ul>
  13. </div>
  14. {% endblock %}
  15. <form action="{{ url(urls.batch.url) }}" method="POST" >
  16. <table>
  17. {% block table_header %}
  18. <tr>
  19. {% for field_name, field_description in fields %}
  20. <td>{{ field_name }}</td>
  21. {% endfor %}
  22. </tr>
  23. {% endblock %}
  24. {% block table_body %}{% endblock %}
  25. {% block table_footer %}
  26. {% if pager.haveToPaginate() %}
  27. <tr>
  28. <td colspan="{{ fields|length }}">
  29. {% if pager.page != pager.previouspage %}
  30. <li><a href="{{ pager.renderLink(pager.previouspage) }}">{% trans 'link_previous_pager' from 'BaseApplicationBundle' %}</a></li>
  31. {% endif %}
  32. {# Set the number of pages to display in the pager #}
  33. {% for page in pager.getLinks(5) %}
  34. {% if page == pager.page %}
  35. <li>{{ page }}</li>
  36. {% else %}
  37. <li><a href="{{ pager.renderLink(page) }}">{{ page }}</a></li>
  38. {% endif %}
  39. {% endfor %}
  40. {% if pager.page != pager.nextpage %}
  41. <li><a href="{{ pager.renderLink(pager.nextpage) }}">{% trans 'link_previous_pager' from 'BaseApplicationBundle' %}</a></li>
  42. {% endif %}
  43. </td>
  44. </tr>
  45. {% endif %}
  46. {% endblock %}
  47. </table>
  48. <div>
  49. <select name="action" >
  50. {% for action, label in batch_actions %}
  51. <option value="{{ action }}">{{ label }}</option>
  52. {% endfor %}
  53. </select>
  54. <input type="submit" value="{% trans 'btn_batch' from 'BaseApplicationBundle' %}" />
  55. </div>
  56. </form>