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(&block) ⇒ 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(&block) ⇒ 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.
8 9 10 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 8 def template @template end |
Instance Method Details
#check_box(&block) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 30 def check_box(*, &block) template.content_tag('div', class: 'checkbox') do template.content_tag('label') do template.concat(super) template.concat(template.capture(&block)) end end end |
#collection_select(method, collection, value_method, text_method, opts = {}, html_opts = {}) ⇒ Object
53 54 55 56 57 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 53 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
10 11 12 13 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 10 def date_field(field, **opts) add_css_class(opts, 'date-picker') text_field(field, opts) end |
#password_field(field, **opts) ⇒ Object
20 21 22 23 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 20 def password_field(field, **opts) add_css_class(opts, 'form-control') super end |
#radio_button(&block) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 39 def (*, &block) template.content_tag('div', class: 'radio') do template.content_tag('label') do template.concat(super) template.concat(template.capture(&block)) end end end |
#select(method, choices = nil, opts = {}, html_opts = {}) ⇒ Object
48 49 50 51 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 48 def select(method, choices = nil, opts = {}, html_opts = {}) add_css_class(html_opts, 'form-control') super end |
#text_area(method, **opts) ⇒ Object
25 26 27 28 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 25 def text_area(method, **opts) add_css_class(opts, 'form-control') super end |
#text_field(field, **opts) ⇒ Object
15 16 17 18 |
# File 'lib/lipstick/helpers/bootstrap_form_builder.rb', line 15 def text_field(field, **opts) add_css_class(opts, 'form-control') super end |