Class: Formidable::FormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Formidable::FormBuilder
- Defined in:
- lib/formidable/form_builder.rb
Constant Summary collapse
- HTML_FIELDS =
%w(date_field date_select email_field file_field number_field password_field search_field telephone_field text_area text_field url_field)
Instance Method Summary collapse
- #button(*args) ⇒ Object
- #check_box(name, *args) ⇒ Object
- #collection_check_boxes(name, *args) ⇒ Object
- #collection_radio_buttons(name, *args) ⇒ Object
- #collection_select(name, *args) ⇒ Object
- #radio_button(name, *args) ⇒ Object
- #select(name, *args) ⇒ Object
- #submit(*args) ⇒ Object
Instance Method Details
#button(*args) ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/formidable/form_builder.rb', line 76 def (*args) = args. if [:disable_on_click] content_tag(:div, class: 'actions') do super(*args, disabled: [:disabled], data: { disable_with: [:disable_on_click] }) end else content_tag :div, super(*args, disabled: [:disabled]), class: 'actions' end end |
#check_box(name, *args) ⇒ Object
53 54 55 56 57 |
# File 'lib/formidable/form_builder.rb', line 53 def check_box(name, *args) content_tag(:div, class: ['field', 'checkbox', custom_class(*args)].reject(&:blank?).join(' ')) do [super, ' ', custom_label(name, *args) ,error(name), hint(*args)].inject(&:+) end end |
#collection_check_boxes(name, *args) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/formidable/form_builder.rb', line 35 def collection_check_boxes(name, *args) content_tag(:div, class: 'field checkbox-buttons') do custom_label(name, *args) + content_tag(:div, class: 'input') do [super, ' ', error(name), hint(*args)].inject(&:+) end end end |
#collection_radio_buttons(name, *args) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/formidable/form_builder.rb', line 44 def (name, *args) content_tag(:div, class: 'field radio-buttons') do custom_label(name, *args) + content_tag(:div, class: 'input') do [super, ' ', error(name), hint(*args)].inject(&:+) end end end |
#collection_select(name, *args) ⇒ Object
29 30 31 32 33 |
# File 'lib/formidable/form_builder.rb', line 29 def collection_select(name, *args) content_tag(:div, class: ['field', 'select', custom_class(*args)].reject(&:blank?).join(' ')) do [custom_label(name, *args), super, ' ', error(name), hint(*args)].inject(&:+) end end |
#radio_button(name, *args) ⇒ Object
59 60 61 62 63 |
# File 'lib/formidable/form_builder.rb', line 59 def (name, *args) content_tag(:div, class: 'field radio') do [super, ' ', custom_label(name, *args) ,error(name), hint(*args)].inject(&:+) end end |
#select(name, *args) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/formidable/form_builder.rb', line 20 def select(name, *args) content_tag(:div, class: ['field', 'select', custom_class(*args)].reject(&:blank?).join(' ')) do custom_label(name, *args) + content_tag(:div, class: 'input') do [super, ' ', error(name), hint(*args)].inject(&:+) end end end |
#submit(*args) ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/formidable/form_builder.rb', line 65 def submit(*args) = args. if [:disable_on_click] content_tag(:div, class: 'actions') do super(*args, disabled: [:disabled], data: { disable_with: [:disable_on_click] }) end else content_tag :div, super(*args, disabled: [:disabled]), class: 'actions' end end |