View Source Torch.PaginationView (Torch v4.3.2)
Phoenix.View
to render pagination controls for Torch-generated index templates.
Link to this section Summary
Functions
The resource name, as an atom, for this view
Generates a "Next >" link to the next page of results. The link is only returned if there is another page.
Generates a "< Prev" link to the previous page of results. The link is only returned if there is a previous page.
Renders the given template locally.
Callback invoked when no template is found. By default it raises but can be customized to render a particular template.
Link to this section Functions
The resource name, as an atom, for this view
Generates a "Next >" link to the next page of results. The link is only returned if there is another page.
examples
Examples
iex> next_link(%Plug.Conn{params: %{}}, 1, 2) |> safe_to_string()
"<a href=\"?page=2\">Next ></a>"
iex> next_link(%Plug.Conn{}, 2, 2)
nil
Generates a "< Prev" link to the previous page of results. The link is only returned if there is a previous page.
examples
Examples
iex> prev_link(%Plug.Conn{params: %{}}, 2) |> safe_to_string()
"<a href=\"?page=1\">< Prev</a>"
If the current page is 1, returns nil
:
iex> prev_link(%Plug.Conn{params: %{}}, 1)
nil
Renders the given template locally.
Callback invoked when no template is found. By default it raises but can be customized to render a particular template.