summaryrefslogtreecommitdiff
path: root/config/initializers/client_side_validations.rb
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-11-19 13:33:23 -0800
committerjessib <jessib@leap.se>2012-11-19 13:33:23 -0800
commit347eb4b20cbe740485dd9d1d7220c01eef659920 (patch)
treeb004aaede235d7c6d2bbd63b8bed5f42d2bce290 /config/initializers/client_side_validations.rb
parent341da14b031c3c27e687c82f479624217c1dbddd (diff)
parent172317b35d9c7ae26a6bf4836feace7b509644a6 (diff)
Merge branch 'develop' into help_develop
Conflicts: app/assets/javascripts/application.js ui_dependencies.rb
Diffstat (limited to 'config/initializers/client_side_validations.rb')
-rw-r--r--config/initializers/client_side_validations.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb
new file mode 100644
index 0000000..2c73fa3
--- /dev/null
+++ b/config/initializers/client_side_validations.rb
@@ -0,0 +1,14 @@
+# ClientSideValidations Initializer
+
+# Uncomment to disable uniqueness validator, possible security issue
+# ClientSideValidations::Config.disabled_validators = [:uniqueness]
+
+# 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
+