Class: PhantomForms::FormBuilders::ValidateFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- PhantomForms::FormBuilders::ValidateFormBuilder
- Defined in:
- lib/phantom_forms/form_builders/validate_form_builder.rb
Constant Summary collapse
- FORM_HELPERS =
%w{text_field password_field text_area file_field number_field email_field telephone_field phone_field url_field select collection_select date_select time_select datetime_select}
Instance Method Summary collapse
- #check_box(name, *args) ⇒ Object
-
#initialize ⇒ ValidateFormBuilder
constructor
A new instance of ValidateFormBuilder.
Constructor Details
#initialize ⇒ ValidateFormBuilder
Returns a new instance of ValidateFormBuilder.
11 12 13 14 15 16 17 18 |
# File 'lib/phantom_forms/form_builders/validate_form_builder.rb', line 11 def initialize(*) super @help_tag, @help_css = if .fetch(:help, '').to_sym == :block [:p, 'help-block'] else [:span, 'help-inline'] end end |
Instance Method Details
#check_box(name, *args) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/phantom_forms/form_builders/validate_form_builder.rb', line 42 def check_box(name, *args) = args..symbolize_keys! content_tag :div, class: "control-group#{(' error' if object.errors[name].any?)}" do content_tag(:div, class: 'controls') do args << .except(:label, :help) html = super(name, *args) + ' ' + [:label] label(name, html, class: 'checkbox') end end end |