Class: Decidim::FilterFormBuilder

Inherits:
FormBuilder
  • Object
show all
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

Methods inherited from FormBuilder

#check_box, #date_field, #datetime_field, #editor, #translated, #upload

Instance Method Details

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

Wrap the category select in a custom fieldset.



38
39
40
41
42
# File 'decidim-core/lib/decidim/filter_form_builder.rb', line 38

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.



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

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.



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

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_select(method, options = {}) ⇒ Object

Wrap the scopes select in a custom fieldset.



45
46
47
48
49
# File 'decidim-core/lib/decidim/filter_form_builder.rb', line 45

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