Skip to main content

Module pagination

Module pagination 

Source
Expand description

Shared pagination context for admin list pages.

Three list pages had each grown their own pagination: different context variable names (page vs current_page), different labels (“Prev” vs “Previous”), one hand-building query strings and one using the querystring filter — and none of them offered a page size or a way to jump to a page.

This builds the context that rcms_admin/_pagination.html renders, so every list gets the same controls from one place. The page arithmetic itself comes from rustango::pagination::Paginator.

Structs§

PageQuery
?page=&per_page= for a list with no other query parameters.
Window
One page of a list: what to fetch and what the partial renders.

Constants§

DEFAULT_PER_PAGE
Rows per page when the request doesn’t say.
MAX_PER_PAGE
Ceiling for ?per_page=. A hostile or fat-fingered value must not turn a list page into a full-table fetch.
PER_PAGE_CHOICES
Offered in the size selector. Kept at/below MAX_PER_PAGE.

Functions§

clamp_per_page
Snap a requested page size to one of PER_PAGE_CHOICES.
context
Build the template context for the shared pagination partial.
offset
Zero-based offset for the current page, for .offset().