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

Link to this function

__phoenix_recompile__?()

View Source

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.

Link to this function

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 &gt;</a>"

iex> next_link(%Plug.Conn{}, 2, 2)
nil
Link to this function

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\">&lt; Prev</a>"

If the current page is 1, returns nil:

iex> prev_link(%Plug.Conn{params: %{}}, 1)
nil
Link to this function

render(template, assigns \\ %{})

View Source

Renders the given template locally.

Link to this function

template_not_found(template, assigns)

View Source

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.