Class: Binco::MaterializeFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Binco::MaterializeFormBuilder
- Defined in:
- app/helpers/binco/materialize_form_builder.rb
Instance Method Summary collapse
- #check_box(method, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
- #checkbox_group(options = {}, &block) ⇒ Object
- #collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
-
#collection_check_boxes2(method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
Since select2 support multiple choices (checkboxes).
- #collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
- #collection_select2(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
- #collection_select_original ⇒ Object
- #datepicker(method, options = {}) ⇒ Object
- #email_field(name, options = {}) ⇒ Object
- #form_group(options = {}, &block) ⇒ Object
- #input_group(options = {}, &block) ⇒ Object
- #number_field(name, options = {}) ⇒ Object
- #password_field(name, options = {}) ⇒ Object
- #radio_button(method, tag_value, options = {}) ⇒ Object
- #radio_group(options = {}, &block) ⇒ Object
- #select(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object
- #select_original ⇒ Object
- #submit(value = nil, options = {}) ⇒ Object
- #telephone_field(name, options = {}) ⇒ Object
- #text_area(method, options = {}) ⇒ Object
- #text_field(name, options = {}) ⇒ Object
Instance Method Details
#check_box(method, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
75 76 77 78 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 75 def check_box(method, = {}, checked_value = "1", unchecked_value = "0") = ('checkbox', ) super method, , checked_value, unchecked_value end |
#checkbox_group(options = {}, &block) ⇒ Object
95 96 97 98 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 95 def checkbox_group( = {}, &block) = ('checkbox', ) group_tag , &block end |
#collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 18 def collection_check_boxes(method, collection, value_method, text_method, = {}, = {}, &block) if block_given? super(method, collection, value_method, text_method, , , &block) else super method, collection, value_method, text_method, , do |b| group_tag class: 'checkbox' do b.label do b.check_box + b.text end end end end end |
#collection_check_boxes2(method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
Since select2 support multiple choices (checkboxes)
33 34 35 36 37 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 33 def collection_check_boxes2(method, collection, value_method, text_method, = {}, = {}) ||= {} [:multiple] = 'multiple' collection_select2 method, collection, value_method, text_method, , end |
#collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
39 40 41 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 39 def collection_select(method, collection, value_method, text_method, = {}, = {}) super method, collection, value_method, text_method, , end |
#collection_select2(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
43 44 45 46 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 43 def collection_select2(method, collection, value_method, text_method, = {}, = {}, &block) = ('select2-rails', ) collection_select(method, collection, value_method, text_method, , ) end |
#collection_select_original ⇒ Object
3 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 3 alias_method :collection_select_original, :collection_select |
#datepicker(method, options = {}) ⇒ Object
60 61 62 63 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 60 def datepicker(method, = {}) = ({ provide: 'datepicker' }, ) text_field(method, ) end |
#email_field(name, options = {}) ⇒ Object
48 49 50 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 48 def email_field(name, = {}) super name, end |
#form_group(options = {}, &block) ⇒ Object
85 86 87 88 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 85 def form_group( = {}, &block) = ('input-field', ) group_tag , &block end |
#input_group(options = {}, &block) ⇒ Object
100 101 102 103 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 100 def input_group( = {}, &block) = ('input-group', ) group_tag , &block end |
#number_field(name, options = {}) ⇒ Object
52 53 54 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 52 def number_field(name, = {}) super name, end |
#password_field(name, options = {}) ⇒ Object
56 57 58 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 56 def password_field(name, = {}) super name, end |
#radio_button(method, tag_value, options = {}) ⇒ Object
70 71 72 73 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 70 def (method, tag_value, = {}) = ('radio', ) super method, tag_value, end |
#radio_group(options = {}, &block) ⇒ Object
90 91 92 93 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 90 def radio_group( = {}, &block) = ('radio', ) group_tag , &block end |
#select(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object
14 15 16 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 14 def select(method, choices = nil, = {}, = {}, &block) super method, choices, , , &block end |
#select_original ⇒ Object
4 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 4 alias_method :select_original, :select |
#submit(value = nil, options = {}) ⇒ Object
80 81 82 83 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 80 def submit(value = nil, = {}) = ('btn', ) super value, end |
#telephone_field(name, options = {}) ⇒ Object
10 11 12 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 10 def telephone_field(name, = {}) super name, end |
#text_area(method, options = {}) ⇒ Object
65 66 67 68 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 65 def text_area(method, = {}) = ('materialize-textarea', ) super(method, ) end |
#text_field(name, options = {}) ⇒ Object
6 7 8 |
# File 'app/helpers/binco/materialize_form_builder.rb', line 6 def text_field(name, = {}) super name, end |