Sha256: c07bea317f378985a3f29e3716fd1fda0854afbe08508461578529abfa8f8192

Contents?: true

Size: 622 Bytes

Versions: 3

Compression:

Stored size: 622 Bytes

Contents

# ClientSideValidations Initializer

require 'client_side_validations/simple_form' if defined?(::SimpleForm)
require 'client_side_validations/formtastic' if defined?(::Formtastic)

# Uncomment the following block if you want each input field to have the validation messages attached.
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
 unless html_tag =~ /^<label/
   %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
 else
   %{<div class="field_with_errors">#{html_tag}</div>}.html_safe
 end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dust-cms-0.0.07 config/initializers/client_side_validations.rb
dust-cms-0.0.06 config/initializers/client_side_validations.rb
dust-cms-0.0.05 config/initializers/client_side_validations.rb