Class: Decidim::FilterFormBuilder
- Inherits:
-
FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- LegacyFormBuilder
- FormBuilder
- Decidim::FilterFormBuilder
- Defined in:
- decidim-core/lib/decidim/filter_form_builder.rb
Overview
This custom FormBuilder is used to create resource filter forms
Instance Method Summary collapse
-
#collection_filter(method:, collection:, label:, id:, **options) ⇒ ActionView::OutputBuffer
This method is used to generate a section of options in a filter block.
- #dropdown_label(item, method, options = {}) ⇒ Object
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, #editor, #form_field_for, #hashtaggable_text_field, #label_for, #max_file_size, #password_field, #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
Methods inherited from LegacyFormBuilder
#autocomplete, #collection_select, #date_select, #datetime_select, #error_for, #label, #radio_button, #select, #submit, #time_zone_select
Instance Method Details
#collection_filter(method:, collection:, label:, id:, **options) ⇒ ActionView::OutputBuffer
This method is used to generate a section of options in a filter block.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'decidim-core/lib/decidim/filter_form_builder.rb', line 25 def collection_filter(method:, collection:, label:, id:, **) type = .delete(:type) || default_form_type_for_collection(collection) case type.to_s when "check_boxes", "check_box", "radio_buttons", "radio_button" .merge!(builder_type: type.to_s.pluralize) type = "collection" when "check_boxes_tree" .merge!(check_boxes_tree_id: check_boxes_tree_id(method.to_s.gsub(/\[|\]/, "_"), id)) end @template.render( "decidim/shared/filters/#{type}", **.merge( method:, collection:, label:, id:, form: self ) ) end |
#dropdown_label(item, method, options = {}) ⇒ Object
48 49 50 |
# File 'decidim-core/lib/decidim/filter_form_builder.rb', line 48 def dropdown_label(item, method, = {}) @template.render("decidim/shared/filters/dropdown_label", **.merge(item:, method:, form: self)) end |