Torch v2.0.0-rc.3 Torch.PaginationView View Source
Phoenix.View
to render pagination controls for Torch-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
__phoenix_recompile__?() View Source
Returns true whenever the list of templates changes in the filesystem.
__resource__() View Source
The resource name, as an atom, for this view
__templates__() View Source
Returns the template root alongside all templates.
next_link(conn, current_page, num_pages, sort_opts \\ nil) View Source
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
prev_link(conn, current_page, sort_opts \\ nil) View Source
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
render(template, assigns \\ %{}) View Source
Renders the given template locally.
template_not_found(template, assigns)
View Source
template_not_found(Phoenix.Template.name(), map()) :: no_return()
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.