base_links.html.twig 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. <div class="text-center">
  8. <ul class="pagination">
  9. {% if admin.datagrid.pager.page > 2 %}
  10. <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, 1)) }}" title="{{ 'link_first_pager'|trans({}, 'SonataAdminBundle') }}">&laquo;</a></li>
  11. {% endif %}
  12. {% if admin.datagrid.pager.page != admin.datagrid.pager.previouspage %}
  13. <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, admin.datagrid.pager.previouspage)) }}" title="{{ 'link_previous_pager'|trans({}, 'SonataAdminBundle') }}">&lsaquo;</a></li>
  14. {% endif %}
  15. {# Set the number of pages to display in the pager #}
  16. {% for page in admin.datagrid.pager.getLinks(admin_pool.getOption('pager_links')) %}
  17. {% if page == admin.datagrid.pager.page %}
  18. <li class="active"><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, page)) }}">{{ page }}</a></li>
  19. {% else %}
  20. <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, page)) }}">{{ page }}</a></li>
  21. {% endif %}
  22. {% endfor %}
  23. {% if admin.datagrid.pager.page != admin.datagrid.pager.nextpage %}
  24. <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, admin.datagrid.pager.nextpage)) }}" title="{{ 'link_next_pager'|trans({}, 'SonataAdminBundle') }}">&rsaquo;</a></li>
  25. {% endif %}
  26. {% if admin.datagrid.pager.page != admin.datagrid.pager.lastpage and admin.datagrid.pager.lastpage != admin.datagrid.pager.nextpage %}
  27. <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, admin.datagrid.pager.lastpage)) }}" title="{{ 'link_last_pager'|trans({}, 'SonataAdminBundle') }}">&raquo;</a></li>
  28. {% endif %}
  29. </ul>
  30. </div>