forage v0.2.0 ForageWeb.ForageView

Helper functions for veiws that feature forage filters, pagination buttons or sort links.

Link to this section Summary

Functions

Datepicker widget based on bootstrap calendar (heavy but gets the work done)

Displays a struct

A filter that works on numbers

A link to the next page of search results. Returns the empty string if the next page doesn’t exist

A link to the previous page of search results. Returns the empty string if the previous page doesn’t exist

An already styled “pagination widget” containing a link to the next page and to the previous page of search results

A link to sort a list of database rows by a certain key

A filter that works on text

A filter that works on time

Link to this section Functions

Link to this macro __using__(options) (macro)
Link to this function forage_active_filters?(conn)
Link to this function forage_date_filter(form, field_spec, opts \\ [])

A filter that works on dates.

It supports the following operators:

  • Equal to
  • Greater than
  • Less than
  • Greater than or equal to
  • Less than or equal to

Examples

TODO

Link to this function forage_date_input(form, field, opts \\ [])

Datepicker widget based on bootstrap calendar (heavy but gets the work done)

Link to this function forage_display(field)

Displays a struct

Link to this function forage_horizontal_form_group(name, opts \\ [], list)

Form group for horizontal forms.

Link to this function forage_numeric_filter(form, name, opts \\ [])

A filter that works on numbers.

It supports the following operators:

  • Equal to
  • Greater than
  • Less than
  • Greater than or equal to
  • Less than or equal to

Examples

TODO

Link to this function forage_pagination_widget(conn, resource, mod, fun, options)

An already styled “pagination widget” containing a link to the next page and to the previous page of search results.

If either the previous page or the next page doesn’t exist, the respective link will be empty.

Link to this function forage_search_form_for(conn, action, options \\ [], fun)
Link to this function forage_select(form, field, opts)

Widget to select …

Required options:

  • :path (required) - the URL from which to request the data This function won’t be applied to values requested from the server after the initial render.
  • :remote_field (required) - The remote field on the other side of the association.
  • :foreign_key (optionsl) - The name of the foreign key (as a string or an atom). If this is not supplied it will default to field_id
Link to this function forage_select_filter(form, field, opts)

Widget to select …

Required options:

  • :path (required) - the URL from which to request the data This function won’t be applied to values requested from the server after the initial render.
  • :remote_field (required) - The remote field on the other side of the association.
  • :foreign_key (optionsl) - The name of the foreign key (as a string or an atom). If this is not supplied it will default to field_id
Link to this function forage_sort_link(conn, mod, fun, field, content, options \\ [])

A link to sort a list of database rows by a certain key.

Link to this function forage_text_filter(form, name, opts \\ [])

A filter that works on text.

It supports the following operators:

  • Contains
  • Equal
  • Starts with
  • Ends with

Examples

TODO

Link to this function forage_time_filter(form, name, opts \\ [])

A filter that works on time.

It supports the following operators:

  • Equal to
  • Greater than
  • Less than
  • Greater than or equal to
  • Less than or equal to

Examples

TODO