Module: JqajaxValidationHelper
- Defined in:
- app/helpers/jqajax_validation_helper.rb
Instance Method Summary collapse
- #init_jqac2_validator ⇒ Object
- #jqac2_data_attribute_for(m = "bla") ⇒ Object
- #jqac2_validate_form ⇒ Object
- #jqac2_validation_for(*vtypes) ⇒ Object
Instance Method Details
#init_jqac2_validator ⇒ Object
43 44 45 |
# File 'app/helpers/jqajax_validation_helper.rb', line 43 def init_jqac2_validator javascript_tag("JqAjaxCore2.Validation.initForms()") end |
#jqac2_data_attribute_for(m = "bla") ⇒ Object
39 40 41 |
# File 'app/helpers/jqajax_validation_helper.rb', line 39 def jqac2_data_attribute_for(m="bla") "data-#{JqajaxCore2::Validations.data_prefix}-#{m.to_s.dasherize}" end |
#jqac2_validate_form ⇒ Object
35 36 37 |
# File 'app/helpers/jqajax_validation_helper.rb', line 35 def jqac2_validate_form JqajaxCore2::Validations.form_validation_class end |
#jqac2_validation_for(*vtypes) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/helpers/jqajax_validation_helper.rb', line 3 def jqac2_validation_for(*vtypes) if vtypes.last.is_a?(Hash) = vtypes.last vtypes.pop else = {} end # validierungsoptionen if [:validator_options] [:validator_options].each do |opt, val| .merge!(jqac2_data_attribute_for(opt) => val) end .delete(:validator_options) end vtypes.each do |vtype| if JqajaxCore2::Validations.settings[vtype.to_sym] .merge!(:class => [[:class], JqajaxCore2::Validations.settings[vtype.to_sym][:class]].compact.join(" ")) elsif vtype.nil? else raise ArgumentError, "Validation of type #{vtype} is not known" end end return end |