-
Notifications
You must be signed in to change notification settings - Fork 209
Open
Description
It's pretty trivial, but I was thinking this library should included something like this:
iex> Scrivener.HTML.pagination_info(%Scrivener.Page{total_pages: 10, page_number: 5, total_entries: 100, page_size: 10}) |> Phoenix.HTML.safe_to_string()
"<div class="pagination_info">
Showing 51 to 60 of 100 entries
</div>"It should be as simple as something like:
def pagination_info(paginator, name \\ "entries") do
text =
with first = (paginator.page_number - 1) * paginator.page_size + 1,
last = min(paginator.page_number * paginator.page_size, paginator.total_entries),
total = paginator.total_entries,
do: "Showing #{first} to #{last} of #{total} #{name}"
content_tag(:div, safe(text), class: "pagination_info")
endReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels