Class: BootstrapFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- BootstrapFormBuilder
- Defined in:
- lib/lipstick/helpers/bootstrap_form_builder.rb
Overview
rubocop:disable Metrics/ParameterLists
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #check_box ⇒ Object
- #collection_select(method, collection, value_method, text_method, opts = {}, html_opts = {}) ⇒ Object
- #date_field(field, **opts) ⇒ Object
- #password_field(field, **opts) ⇒ Object
- #radio_button ⇒ Object
- #select(method, choices = nil, opts = {}, html_opts = {}) ⇒ Object
- #text_area(method, **opts) ⇒ Object
- #text_field(field, **opts) ⇒ Object
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
5 6 7 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 5 def template @template end |
Instance Method Details
#check_box ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 27 def check_box(*) template.content_tag('div', class: 'checkbox') do template.content_tag('label') do template.concat(super) template.concat(template.capture { yield }) end end end |
#collection_select(method, collection, value_method, text_method, opts = {}, html_opts = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 50 def collection_select(method, collection, value_method, text_method, opts = {}, html_opts = {}) add_css_class(html_opts, 'form-control') super end |
#date_field(field, **opts) ⇒ Object
7 8 9 10 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 7 def date_field(field, **opts) add_css_class(opts, 'date-picker') text_field(field, opts) end |
#password_field(field, **opts) ⇒ Object
17 18 19 20 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 17 def password_field(field, **opts) add_css_class(opts, 'form-control') super end |
#radio_button ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 36 def (*) template.content_tag('div', class: 'radio') do template.content_tag('label') do template.concat(super) template.concat(template.capture { yield }) end end end |
#select(method, choices = nil, opts = {}, html_opts = {}) ⇒ Object
45 46 47 48 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 45 def select(method, choices = nil, opts = {}, html_opts = {}) add_css_class(html_opts, 'form-control') super end |
#text_area(method, **opts) ⇒ Object
22 23 24 25 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 22 def text_area(method, **opts) add_css_class(opts, 'form-control') super end |
#text_field(field, **opts) ⇒ Object
12 13 14 15 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 12 def text_field(field, **opts) add_css_class(opts, 'form-control') super end |