Lit.PaginationView (Lit v0.1.2) View Source
Phoenix.View
to render pagination controls for Lit-generated index templates.
Link to this section Summary
Functions
Returns true whenever the list of templates changes in the filesystem.
The resource name, as an atom, for this view
Returns the template root alongside all templates.
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
Returns true whenever the list of templates changes in the filesystem.
The resource name, as an atom, for this view
Returns the template root alongside all templates.
Generates a "Next >" link to the next page of results. The link is only returned if there is another page.
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
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.
Specs
template_not_found(Phoenix.Template.name(), map()) :: no_return()
Callback invoked when no template is found. By default it raises but can be customized to render a particular template.