Torch v1.0.0-rc.2 Torch.PaginationView

Phoenix.View to render pagination controls for Torch-generated index templates.

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

Generates a “< Prev” link to the previous page of results

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

Functions

__phoenix_recompile__?()

Returns true whenever the list of templates changes in the filesystem.

__resource__()

The resource name, as an atom, for this view

__templates__()

Returns the template root alongside all templates.

next_link(current_page, num_pages)

Generates a “Next >” link to the next page of results.

The link is only returned if there is another page.

Example

next_link(1, 2)
# => returns link

next_link(2, 2)
# => returns nil
prev_link(current_page, num_pages)

Generates a “< Prev” link to the previous page of results.

The link is only returned if there is a previous page.

Example

prev_link(2, 2)
# => returns link

prev_link(1, 1)
# => returns nil
render(template, assigns \\ %{})

Renders the given template locally.

template_not_found(template, assigns)

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.