diff options
author | Azul <azul@riseup.net> | 2016-03-24 11:24:19 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-05-02 08:28:43 -0300 |
commit | afc1daac6745cd6b4543d2b542c6f03cfc32e1eb (patch) | |
tree | f7104e7fac83fcd94f606d7e87bdd5569801ecda /config/initializers | |
parent | 9b9daf95357f4fa5fd1eb95b16e2cf043937bdc0 (diff) |
upgrade: client_side_validations initializer
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/client_side_validations.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb index 252aded..f7a658a 100644 --- a/config/initializers/client_side_validations.rb +++ b/config/initializers/client_side_validations.rb @@ -1,9 +1,16 @@ # ClientSideValidations Initializer -# Uncomment to disable uniqueness validator, possible security issue -ClientSideValidations::Config.disabled_validators = [:uniqueness] +# Disabled validators. The uniqueness validator is disabled by default for security issues. Enable it on your own responsibility! +# ClientSideValidations::Config.disabled_validators = [:uniqueness] + +# Uncomment to validate number format with current I18n locale +# ClientSideValidations::Config.number_format_with_locale = true # Uncomment the following block if you want each input field to have the validation messages attached. +# +# Note: client_side_validation requires the error to be encapsulated within +# <label for="#{instance.send(:tag_id)}" class="message"></label> + 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 @@ -11,4 +18,3 @@ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| %{<div class="field_with_errors">#{html_tag}</div>}.html_safe end end - |