Module: Campo::Plugins::JQueryValidation::InstanceMethods::Outputter
- Defined in:
- lib/campo/plugins/jqueryvalidation.rb
Overview
def
Instance Attribute Summary collapse
-
#jqv_form_names ⇒ Object
holds the names of form(s).
Instance Method Summary collapse
-
#jquery_script_declaration ⇒ Object
builds the declaration for the top of the output.
Instance Attribute Details
#jqv_form_names ⇒ Object
holds the names of form(s)
110 111 112 |
# File 'lib/campo/plugins/jqueryvalidation.rb', line 110 def jqv_form_names @jqv_form_names end |
Instance Method Details
#jquery_script_declaration ⇒ Object
builds the declaration for the top of the output
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/campo/plugins/jqueryvalidation.rb', line 113 def jquery_script_declaration unless jqv_form_names.nil? || jqv_form_names.empty? @jqv_form_names.reduce(":javascript\n") do |mem,name| mem + <<STR $().ready(function(){ $("##{name}").validate({ #{JQueryValidation::Rules.render} }); }); STR end else "" # just in case there are no forms for some reason end end |