Class: TailwindForm::FormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- TailwindForm::FormBuilder
- Defined in:
- lib/tailwind_form/form_builder.rb
Instance Method Summary collapse
- #form_group(name, classes = 'form__group', field_type = :text_field) ⇒ Object
- #tailwind_label_field(name) ⇒ Object
- #tailwind_text_area(name) ⇒ Object
- #tailwind_text_field(name) ⇒ Object
Instance Method Details
#form_group(name, classes = 'form__group', field_type = :text_field) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/tailwind_form/form_builder.rb', line 24 def form_group(name, classes = 'form__group', field_type = :text_field) function_name = "tailwind_#{field_type}" @template.content_tag :div, class: classes do tailwind_label_field(name) + send(function_name, name) end end |
#tailwind_label_field(name) ⇒ Object
5 6 7 8 |
# File 'lib/tailwind_form/form_builder.rb', line 5 def tailwind_label_field(name) = { class: 'form__label' } label(name, ) end |
#tailwind_text_area(name) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/tailwind_form/form_builder.rb', line 17 def tailwind_text_area(name) = { class: 'form__input' } @template.content_tag :div, class: 'form__inputGroup' do text_area(name, ) end end |
#tailwind_text_field(name) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/tailwind_form/form_builder.rb', line 10 def tailwind_text_field(name) = { class: 'form__input' } @template.content_tag :div, class: 'form__inputGroup' do text_field(name, ) end end |