Kerosene v0.9.0 Kerosene.HTML View Source
Html helpers to render the pagination links and more,
import the Kerosene.HTML
in your view module.
defmodule MyApp.ProductView do
use MyApp.Web, :view
import Kerosene.HTML
end
now you have these view helpers in your template file.
<%= paginate @conn, @page %>
Where @page
is a %Kerosene{}
struct returned from Repo.paginate/2
.
paginate
helper takes keyword list of options
and params
.
<%= paginate @conn, @page, window: 5, next_label: “>>”, previous_label: “<<”, first: true, last: true, first_label: “First”, last_label: “Last” %>
Link to this section Summary
Functions
Generates the HTML pagination links for a given page returned by Kerosene
Link to this section Functions
Generates the HTML pagination links for a given page returned by Kerosene.
The theme
indicates which CSS framework you are using. The default is
:bootstrap
, but you can add your own using the Kerosene.HTML.do_paginate/3
function
if desired. Kerosene provides few themes out of the box:
[:bootstrap, :bootstrap4, :foundation, :semantic]
Example:
iex> Kerosene.HTML.paginate(@conn, @kerosene)
Path can be overriden by adding setting :path
in the opts
.
For example:
Kerosene.HTML.paginate(@conn, @kerosene, path: product_path(@conn, :index, foo: "bar"))
Additional panigation class can be added by adding setting :class
in the opts
.
For example:
Kerosene.HTML.paginate(@conn, @kerosene, theme: :boostrap4, class: "paginate-sm")