Module: ClientSideValidations::SimpleForm::FormBuilder
- Defined in:
- lib/client_side_validations/simple_form/form_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #client_side_form_settings(options, _form_helper) ⇒ Object
- #input_with_client_side_validations(attribute_name, options = {}, &block) ⇒ Object
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/client_side_validations/simple_form/form_builder.rb', line 4 def self.included(base) base.class_eval do alias_method_chain :input, :client_side_validations end end |
Instance Method Details
#client_side_form_settings(options, _form_helper) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/client_side_validations/simple_form/form_builder.rb', line 10 def client_side_form_settings(, _form_helper) { type: self.class.to_s, error_class: wrapper.find(:error).defaults[:class].first, error_tag: wrapper.find(:error).defaults[:tag], wrapper_error_class: wrapper.defaults[:error_class], wrapper_tag: wrapper.defaults[:tag], wrapper_class: wrapper.defaults[:class].first, wrapper: [:wrapper] || ::SimpleForm.default_wrapper } end |
#input_with_client_side_validations(attribute_name, options = {}, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/client_side_validations/simple_form/form_builder.rb', line 22 def input_with_client_side_validations(attribute_name, = {}, &block) if .key?(:validate) [:input_html] ||= {} [:input_html][:validate] = [:validate] .delete(:validate) end input_without_client_side_validations(attribute_name, , &block) end |