You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.1 KiB

  1. {% macro pagination_widget(pagination, endpoint) %}
  2. <ul class="pagination">
  3. <li{% if not pagination.has_prev %} class="disabled"{% endif %}>
  4. <a href="{% if pagination.has_prev %}{{ url_for(endpoint, page=pagination.prev_num, **kwargs) }}{% else %}#{% endif %}">
  5. &laquo;
  6. </a>
  7. </li>
  8. {% for p in pagination.iter_pages() %}
  9. {% if p %}
  10. {% if p == pagination.page %}
  11. <li class="active">
  12. <a href="{{ url_for(endpoint, page = p, **kwargs) }}">{{ p }}</a>
  13. </li>
  14. {% else %}
  15. <li>
  16. <a href="{{ url_for(endpoint, page = p, **kwargs) }}">{{ p }}</a>
  17. </li>
  18. {% endif %}
  19. {% else %}
  20. <li class="disabled"><a href="#">&hellip;</a></li>
  21. {% endif %}
  22. {% endfor %}
  23. <li{% if not pagination.has_next %} class="disabled"{% endif %}>
  24. <a href="{% if pagination.has_next %}{{ url_for(endpoint, page=pagination.next_num, **kwargs) }}{% else %}#{% endif %}">
  25. &raquo;
  26. </a>
  27. </li>
  28. </ul>
  29. {% endmacro %}