Scrivener.PhoenixView (scrivener_phoenix v0.3.2) View Source
The module which provides the helper to generate links for a Scrivener pagination.
Link to this section Summary
Functions
Generates the whole HTML to navigate between pages.
Link to this section Types
Specs
options() :: %{ left: non_neg_integer(), right: non_neg_integer(), window: non_neg_integer(), outer_window: non_neg_integer(), live: boolean() | nil, inverted: boolean(), display_if_single: boolean(), param_name: atom() | String.t(), merge_params: boolean() | [atom() | String.t()], template: module(), labels: %{ first: String.t(), prev: String.t(), next: String.t(), last: String.t() }, symbols: %{ first: String.t(), prev: String.t(), next: String.t(), last: String.t() } }
Link to this section Functions
Specs
has_next?(page :: Scrivener.Page.t()) :: boolean()
Specs
has_prev?(page :: Scrivener.Page.t()) :: boolean()
Specs
paginate( conn :: conn_or_socket_or_endpoint(), spage :: Scrivener.Page.t(), fun :: function(), arguments :: list(), options :: Keyword.t() ) :: Phoenix.HTML.safe()
Generates the whole HTML to navigate between pages.
Options:
- left (default:
0
): display the left first pages - right (default:
0
): display the right last pages - window (default:
4
): display window pages before and after the current page (eg, if 7 is the current page and window is 2, you'd get:5 6 7 8 9
) - outer_window (default:
0
), equivalent to left = right = outer_window: display the outer_window first and last pages (eg valued to 2:« First ‹ Prev 1 2 ... 5 6 7 8 9 ... 19 20 Next › Last »
as opposed to left = 1 and right = 3:« First ‹ Prev 1 ... 5 6 7 8 9 ... 18 19 20 Next › Last »
) - live (default:
nil
):true
to generate links withPhoenix.LiveView.Helpers.live_patch/2
instead ofPhoenix.HTML.Link.link/2
nil
to set it automatically totrue
whenpaginate/5
is called with a%Phoenix.LiveView.Socket{}
as its first parameter elsefalse
- inverted (default:
false
):true
to first (left side) link last pages instead of first - display_if_single (default:
false
):true
to force a pagination to be displayed when there only is a single page of result(s) - param_name (default:
:page
): the name of the parameter generated in URL (query string) to propagate the page number - merge_params (default:
false
):true
to copy the entire query string between requests,false
to ignore it or a list of the parameter names to only reproduce - template (default:
Scrivener.Phoenix.Template.Bootstrap4
): the module which implementsScrivener.Phoenix.Template
to use to render links to pages - symbols (default:
%{first: "«", prev: "‹", next: "›", last: "»"}
): the symbols to add before or after the label for the first, previous, next and last page (nil
or""
for none) - labels (default:
%{first: dgettext("scrivener_phoenix", "First"), prev: dgettext("scrivener_phoenix", "Prev"), next: dgettext("scrivener_phoenix", "Next"), last: dgettext("scrivener_phoenix", "Last")}
): the texts used by links to describe the first, previous, next and last page