{# Pagination component with HTMX infinite scroll support. Usage: {% from "components/pagination.html" import infinite_scroll_trigger, page_links %} {# Infinite scroll (HTMX) #} {{ infinite_scroll_trigger(url="/items?page=2", colspan=3, has_more=True) }} {# Traditional pagination #} {{ page_links(current_page=1, total_pages=5, base_url="/items") }} #} {% macro infinite_scroll_trigger(url, colspan=1, has_more=True, target=None) %} {% if has_more %} Loading more... {% endif %} {% endmacro %} {% macro page_links(current_page, total_pages, base_url, class="") %} {% endmacro %} {% macro page_info(page, limit, total) %}
Showing {{ (page - 1) * limit + 1 }}-{{ [page * limit, total] | min }} of {{ total }}
{% endmacro %}