Class: Decidim::FilterFormBuilder

Inherits:
FormBuilder
  • Object
show all
Defined in:
lib/decidim/filter_form_builder.rb

Overview

This custom FormBuilder is used to create resource filter forms

Instance Method Summary collapse

Methods inherited from FormBuilder

#check_box, #data_picker, #date_field, #datetime_field, #editor, #form_field_for, #hashtaggable_text_field, #label_for, #social_field, #translated, #translated_one_locale, #upload

Instance Method Details

#areas_select(method, collection, options = {}) ⇒ Object

Wrap the areas select in a custom fieldset.



44
45
46
47
48
# File 'lib/decidim/filter_form_builder.rb', line 44

def areas_select(method, collection, options = {})
  fieldset_wrapper options[:legend_title] do
    super(method, collection, options)
  end
end

#categories_select(method, collection, options = {}) ⇒ Object

Wrap the category select in a custom fieldset.



37
38
39
40
41
# File 'lib/decidim/filter_form_builder.rb', line 37

def categories_select(method, collection, options = {})
  fieldset_wrapper options[:legend_title] do
    super(method, collection, options)
  end
end

#collection_check_boxes(method, collection, value_method, label_method, options = {}, html_options = {}) ⇒ Object

Wrap the check_boxes collection in a custom fieldset. It also renders the inputs inside its labels.



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/decidim/filter_form_builder.rb', line 24

def collection_check_boxes(method, collection, value_method, label_method, options = {}, html_options = {})
  fieldset_wrapper options[:legend_title] do
    super(method, collection, value_method, label_method, options, html_options) do |builder|
      if block_given?
        yield builder
      else
        builder.label { builder.check_box + builder.text }
      end
    end
  end
end

#collection_radio_buttons(method, collection, value_method, label_method, options = {}, html_options = {}) ⇒ Object

Wrap the radio buttons collection in a custom fieldset. It also renders the inputs inside its labels.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/decidim/filter_form_builder.rb', line 10

def collection_radio_buttons(method, collection, value_method, label_method, options = {}, html_options = {})
  fieldset_wrapper options[:legend_title] do
    super(method, collection, value_method, label_method, options, html_options) do |builder|
      if block_given?
        yield builder
      else
        builder.label { builder.radio_button + builder.text }
      end
    end
  end
end

#scopes_picker(method, options = { checkboxes_on_top: true }) ⇒ Object

Wrap the scopes picker in a custom fieldset.



51
52
53
54
55
# File 'lib/decidim/filter_form_builder.rb', line 51

def scopes_picker(method, options = { checkboxes_on_top: true })
  fieldset_wrapper options[:legend_title] do
    super(method, options)
  end
end