ForageWeb.ForageView (forage v0.4.0)

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

Link to this section Summary

Functions

Imports functions from ForageWeb.ForageView and defines a number of functions specialized for the given resource.

A filter that works on dates.

A filter that works on datetime objects.

Form group for horizontal forms.

Widget to select multiple external resources using the Javascript Select2 widget.

A filter that works on numbers.

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

A link to the previous page of filter 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 filter results.

Widget to select multiple external resources using the Javascript Select2 widget.

Widget to select an external resource using the Javascript Select2 widget.

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.

Creates a fragment that can be reused in the same template.

Link to this section Functions

Link to this macro

__using__(options)

(macro)

Imports functions from ForageWeb.ForageView and defines a number of functions specialized for the given resource.

TODO: complete this.

Link to this function

forage_active_filters?(conn)

Link to this function

forage_as_html(resource)

Link to this function

forage_as_text(resource)

Link to this function

forage_checkbox(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.checkbox/3.

Link to this function

forage_color_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.color_input/3.

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 \\ [])

See docs for Phoenix.HTML.Form.date_input/3.

Link to this function

forage_date_select(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.date_select/3.

Link to this function

forage_datetime_filter(form, name, opts \\ [])

A filter that works on datetime objects.

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_datetime_local_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.datetime_local_input/3.

Link to this function

forage_datetime_select(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.datetime_select/3.

Link to this function

forage_email_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.email_input/3.

Link to this function

forage_error_tag(form, field, error_helpers)

Link to this function

forage_file_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.file_input/3.

Link to this function

forage_filter_form_for(conn, action, options \\ [], fun)

Specs

Link to this function

forage_form_check(form, field, label, error_helpers, input_fun)

Link to this function

forage_form_group(form, field, label, error_helpers, input_fun)

Link to this function

forage_horizontal_form_group(name, opts \\ [], list)

Form group for horizontal forms.

Link to this function

forage_inline_form_check(form, field, label, error_helpers, input_fun)

Link to this function

forage_input_type(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.input_type/3.

Link to this function

forage_multiple_select(form, field, opts)

Widget to select multiple external resources using the Javascript Select2 widget.

Parameters:

  • form (%Phoenix.HTml.Form.t/1)- the form
  • field (atom)

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
  • :foreign_key (optional) - 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_number_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.number_input/3.

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 filter results.

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

TODO

Link to this function

forage_password_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.password_input/3.

Link to this function

forage_radio_button(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.radio_button/3.

Link to this function

forage_range_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.range_input/3.

Link to this function

forage_row(widgets)

Link to this function

forage_search_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.search_input/3.

Link to this function

forage_select(form, field, opts)

Widget to select multiple external resources using the Javascript Select2 widget.

Parameters:

  • form (%Phoenix.HTml.Form.t/1)- the form
  • displayer (module) - a module with a displayer.as_text/1 function to display the foreign resource.
  • field (atom)

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.
  • :foreign_key (optional) - 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 an external resource using the Javascript Select2 widget.

Parameters:

  • form (%Phoenix.HTml.Form.t/1)- the form
  • field (atom)

Required options:

  • :path (required) - the URL from which to request the data
  • :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_static_select(form, field, opts)

Link to this function

forage_telephone_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.telephone_input/3.

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_text_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.text_input/3.

Link to this function

forage_textarea(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.textarea/3.

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

Link to this function

forage_time_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.time_input/3.

Link to this function

forage_time_select(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.time_select/3.

Link to this function

forage_url_input(form, field, opts \\ [])

See docs for Phoenix.HTML.Form.url_input/3.

Link to this macro

fragment(var, list)

(macro)

Creates a fragment that can be reused in the same template.

It's meant to be used in an EEx template, which has some synctatic restrictions that make it hard to set a variable to a an EEx fragment.

Example

<%= fragment widget do %>
  <div class="my-widget">
    Add an EEx fragment here.
    Can contain <%= @dynamic %> fragments.
  </div>
<% end %>

<%= widget %>