Dissolver v0.9.3 Dissolver.JSON View Source

JSON helpers to render the pagination links in json format. import the Dissolver.JSON in your view module.

defmodule MyApp.ProductView do
  use MyApp.Web, :view
  import Dissolver.JSON

  def render("index.json", %{conn: conn, products: products, paginator: paginator}) do
    %{data: render_many(products, MyApp.ProductView, "product.json"),
      pagination: paginate(conn, paginator)}
  end
end

Where paginator is a %Dissolver.Paginator{} struct returned from Dissolver.paginate/2.

paginate helper takes keyword list of options. paginate(paginator, window: 5, next_label: ">>", previous_label: "<<", first: true, last: true, first_label: "First", last_label: "Last")

Link to this section Summary

Link to this section Functions

Link to this function

paginate(conn, paginator, opts \\ [])

View Source
Link to this function

render_page_list(page_list)

View Source