ForageWeb.ForageView behaviour (forage v0.5.0)
Helper functions for views 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.
See docs for Phoenix.HTML.Form.datetime_local_input/3
.
See docs for Phoenix.HTML.Form.datetime_local_input/3
.
See docs for Phoenix.HTML.Form.datetime_local_input/3
.
See docs for Phoenix.HTML.Form.datetime_select/3
.
See docs for Phoenix.HTML.Form.datetime_select/3
.
Form group with support for internationalization.
Horizontal form group with support for internationalization by taking in
the application's error_helpers
module.
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.
See docs for Phoenix.HTML.Form.password_input/3
.
See docs for Phoenix.HTML.Form.password_input/3
.
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.
Widget to select multiple external resources using the Javascript Select2 widget.
See docs for Phoenix.HTML.Form.telephone_input/3
.
See docs for Phoenix.HTML.Form.telephone_input/3
.
A filter that works on text.
A filter that works on time.
Creates a fragment that can be reused in the same template.
Callbacks
Specialized version of ForageWeb.ForageView.forage_form_check/6
.
that's meant to use the application's error helpers module for internationalization.
Specialized version of ForageWeb.ForageView.forage_form_group/6
that's meant to use the application's error helpers module for internationalization.
Specialized version of ForageWeb.ForageView.forage_horizontal_form_group/6
.
that's meant to use the application's error helpers module for internationalization.
Specialized version of ForageWeb.ForageView.forage_inline_form_check/6
.
that's meant to use the application's error helpers module for internationalization.
Link to this section Types
form_data()
Specs
form_data() :: Phoenix.HTML.FormData.t()
form_field()
Specs
form_field() :: atom()
options()
Specs
options() :: Keyword.t()
safe_html()
Specs
safe_html() :: Phoenix.HTML.Safe.t()
Link to this section Functions
Imports functions from ForageWeb.ForageView
and defines a number of functions
specialized for the given resource.
TODO: complete this.
forage_active_filters?(conn)
forage_as_html(resource)
forage_as_text(resource)
forage_checkbox(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.checkbox/3
.
forage_checkbox_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.checkbox/3
.
forage_checkbox_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.checkbox/3
.
forage_color_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.color_input/3
.
forage_color_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.color_input/3
.
forage_color_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.color_input/3
.
forage_date_filter(form, name, 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
forage_date_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.date_input/3
.
forage_date_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.date_input/3
.
forage_date_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.date_input/3
.
forage_date_select(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.date_select/3
.
forage_date_select_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.date_select/3
.
forage_date_select_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.date_select/3
.
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
forage_datetime_local_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.datetime_local_input/3
.
forage_datetime_local_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.datetime_local_input/3
.
forage_datetime_local_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.datetime_local_input/3
.
forage_datetime_select(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.datetime_select/3
.
forage_datetime_select_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.datetime_select/3
.
forage_datetime_select_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.datetime_select/3
.
forage_email_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.email_input/3
.
forage_email_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.email_input/3
.
forage_email_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.email_input/3
.
forage_error_tag(form, field, error_helpers)
forage_file_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.file_input/3
.
forage_file_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.file_input/3
.
forage_file_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.file_input/3
.
forage_filter_form_for(conn, action, options \\ [], fun)
Specs
forage_filter_form_for( Phoenix.HTML.FormData.t(), String.t(), Keyword.t(), (Phoenix.HTML.FormData.t() -> Phoenix.HTML.unsafe()) ) :: Phoenix.HTML.safe()
forage_form_check(form, field, label, error_helpers, opts, input_fun)
TODO
forage_form_group(form, field, label, error_helpers, opts \\ [], input_fun)
Form group with support for internationalization.
forage_horizontal_error_tag(form, field, error_helpers, class)
forage_horizontal_form_group(form, field, label, error_helpers, opts, input_fun)
Horizontal form group with support for internationalization by taking in
the application's error_helpers
module.
You shouldn't need to use this function directly.
You can use the ForageWeb.ForageView.forage_form_group/5
callback
defined in your view module, which impoements a specialized version
of this function using your application's error_helpers
module.
forage_inline_form_check(form, field, label, error_helpers, opts, input_fun)
TODO
forage_input_type(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.input_type/3
.
forage_input_type_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.input_type/3
.
forage_input_type_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.input_type/3
.
forage_multiple_select(form, field, path, opts)
Widget to select multiple external resources using the Javascript Select2 widget.
Parameters:
form
(%Phoenix.Html.Form.t/1
)- the formfield
(atom)path
(binary) - the URL from which to request the data
Options:
: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"
forage_number_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.number_input/3
.
forage_number_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.number_input/3
.
forage_number_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.number_input/3
.
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
forage_pagination_link_next(conn, resource, mod, fun, contents)
A link to the next page of filter results. Returns the empty string if the next page doesn't exist.
forage_pagination_link_previous(conn, resource, mod, fun, contents)
A link to the previous page of filter results. Returns the empty string if the previous page doesn't exist.
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
forage_password_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.password_input/3
.
forage_password_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.password_input/3
.
forage_password_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.password_input/3
.
forage_radio_button(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.radio_button/3
.
forage_radio_button_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.radio_button/3
.
forage_radio_button_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.radio_button/3
.
forage_range_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.range_input/3
.
forage_range_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.range_input/3
.
forage_range_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.range_input/3
.
forage_row(widgets)
forage_search_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.search_input/3
.
forage_search_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.search_input/3
.
forage_search_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.search_input/3
.
forage_select(form, field, path, opts \\ [])
Widget to select multiple external resources using the Javascript Select2 widget.
Parameters:
form
(%Phoenix.Html.Form.t/1
)- the formfield
(atom)path
- the URL from which to request the data
Options:
:foreign_key
(optional) - The name of the foreign key (as a string or an atom). If this is not supplied it will default tofield_id
forage_select_filter(form, field, path, opts \\ [])
Widget to select an external resource using the Javascript Select2 widget.
Parameters:
form
(%Phoenix.Html.Form.t/1
)- the formfield
(atom)path
(binary) - the URL from which to request the data
Options:
:foreign_key
(optionsl) - The name of the foreign key (as a string or an atom). If this is not supplied it will default tofield_id
forage_sort_link(conn, mod, fun, field, content, options \\ [])
A link to sort a list of database rows by a certain key.
forage_static_select(form, field, opts \\ [])
Widget to select multiple external resources using the Javascript Select2 widget.
Parameters:
form
(%Phoenix.Html.Form.t/1
)- the formfield
(atom)
Options:
: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"
forage_telephone_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.telephone_input/3
.
forage_telephone_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.telephone_input/3
.
forage_telephone_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.telephone_input/3
.
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
forage_text_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.text_input/3
.
forage_text_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.text_input/3
.
forage_text_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.text_input/3
.
forage_textarea(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.textarea/3
.
forage_textarea_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.textarea/3
.
forage_textarea_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.textarea/3
.
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
forage_time_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.time_input/3
.
forage_time_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.time_input/3
.
forage_time_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.time_input/3
.
forage_time_select(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.time_select/3
.
forage_time_select_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.time_select/3
.
forage_time_select_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.time_select/3
.
forage_url_input(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.url_input/3
.
forage_url_input_large(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.url_input/3
.
forage_url_input_small(form, field, opts \\ [])
See docs for Phoenix.HTML.Form.url_input/3
.
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 %>
Link to this section Callbacks
forage_form_check(form_data, form_field, arg3, options, function)
Specs
forage_form_check( form_data(), form_field(), String.t(), options(), (form_data(), form_field(), options() -> safe_html()) ) :: safe_html()
Specialized version of ForageWeb.ForageView.forage_form_check/6
.
that's meant to use the application's error helpers module for internationalization.
This callback is automatically implemented by use ForageWeb.ForageView, ...
Examples
TODO
forage_form_group(form_data, form_field, arg3, options, function)
Specs
forage_form_group( form_data(), form_field(), String.t(), options(), (form_data(), form_field(), options() -> safe_html()) ) :: safe_html()
Specialized version of ForageWeb.ForageView.forage_form_group/6
that's meant to use the application's error helpers module for internationalization.
This callback is automatically implemented by use ForageWeb.ForageView, ...
Examples
TODO
forage_horizontal_form_group(form_data, form_field, arg3, options, function)
Specs
forage_horizontal_form_group( form_data(), form_field(), String.t(), options(), (form_data(), form_field(), options() -> safe_html()) ) :: safe_html()
Specialized version of ForageWeb.ForageView.forage_horizontal_form_group/6
.
that's meant to use the application's error helpers module for internationalization.
This callback is automatically implemented by use ForageWeb.ForageView, ...
Examples
TODO
forage_inline_form_check(form_data, form_field, arg3, options, function)
Specs
forage_inline_form_check( form_data(), form_field(), String.t(), options(), (form_data(), form_field(), options() -> safe_html()) ) :: safe_html()
Specialized version of ForageWeb.ForageView.forage_inline_form_check/6
.
that's meant to use the application's error helpers module for internationalization.
This callback is automatically implemented by use ForageWeb.ForageView, ...
Examples
TODO