Class: Decidim::Initiatives::InitiativesFilterFormBuilder
- Inherits:
-
FilterFormBuilder
- Object
- FoundationRailsHelper::FormBuilder
- FormBuilder
- FilterFormBuilder
- Decidim::Initiatives::InitiativesFilterFormBuilder
- Defined in:
- decidim-initiatives/lib/decidim/initiatives/initiatives_filter_form_builder.rb
Overview
This custom Form builder add the fields needed to deal with Initiative types.
Instance Method Summary collapse
-
#initiative_types_select(name, collection, options = {}) ⇒ Object
Public: Generates a select field with the initiative types.
Methods inherited from FilterFormBuilder
#areas_select, #categories_select, #check_boxes_tree, #collection_check_boxes, #collection_radio_buttons, #custom_select, #scopes_picker
Methods inherited from FormBuilder
#areas_select, #attachment, #categories_select, #check_box, #choose_button_label, #collection_check_boxes, #collection_radio_buttons, #create_language_selector, #data_picker, #date_field, #datetime_field, #editor, #form_field_for, #hashtaggable_text_field, #label_for, #max_file_size, #resources_select, #scopes_picker, #social_field, #text_area, #translated, #translated_one_locale, #upload, #upload_help
Methods included from Map::Autocomplete::FormBuilder
Methods included from TranslatableAttributes
Instance Method Details
#initiative_types_select(name, collection, options = {}) ⇒ Object
Public: Generates a select field with the initiative types.
name - The name of the field (usually type_id) collection - A collection of initiative types. options - An optional Hash with options:
-
prompt - An optional String with the text to display as prompt.
Returns a String.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'decidim-initiatives/lib/decidim/initiatives/initiatives_filter_form_builder.rb', line 16 def initiative_types_select(name, collection, = {}) selected = object.send(name) types = (selected, collection) prompt = .delete(:prompt) remote_path = .delete(:remote_path) || false multiple = .delete(:multiple) || false = { multiple: multiple, class: "select2", "data-remote-path" => remote_path, "data-placeholder" => prompt } select(name, @template.(types, selected: selected), , ) end |