client_side_validations 8.0.1 → 8.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fed0feff4a513664392a746868722e04d5812444
|
4
|
+
data.tar.gz: b0c93e7e5a06f28666f63241b9a446378ce39376
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d92f7babb26e804be9a632593c70319dff02af7a9332f185eb6fbc9a894dc16195729eb7df31d50fea765d8c16a1b89f93f9337879347ace22654334e09b87d1
|
7
|
+
data.tar.gz: 6aef78c42b2ab083780fdcdc4379597b6a370e026b5ad7b3b96e84bf85fdc1591457a77c4b5b2bb15c5a0f4c5b3fafef76df31eeaf6d59f846fd80bd9aea51fb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -85,6 +85,10 @@ following to your `app/assets/javascripts/application.js` file.
|
|
85
85
|
//= require rails.validations
|
86
86
|
```
|
87
87
|
|
88
|
+
Note: If you are using [Turbolinks](https://github.com/turbolinks/turbolinks),
|
89
|
+
make sure that `rails.validations` is required **after** `turbolinks`, so
|
90
|
+
ClientSideValidations can properly attach its event handler.
|
91
|
+
|
88
92
|
In your `FormBuilder` you only need to enable validations:
|
89
93
|
|
90
94
|
```erb
|
@@ -414,6 +418,17 @@ div.field_with_errors div.ui-effects-wrapper {
|
|
414
418
|
|
415
419
|
Finally uncomment the `ActionView::Base.field_error_proc` override in `config/initializers/client_side_validations.rb`
|
416
420
|
|
421
|
+
## Disable validators ##
|
422
|
+
|
423
|
+
If you want to disable some validators, set the `disabled_validators` config variable in `config/initializers/client_side_validations.rb`:
|
424
|
+
|
425
|
+
```ruby
|
426
|
+
# Example: disable the presence validator
|
427
|
+
ClientSideValidations::Config.disabled_validators = [:presence]
|
428
|
+
```
|
429
|
+
|
430
|
+
Note that the `FormBuilder` will automatically skip building validators that are disabled.
|
431
|
+
|
417
432
|
## Authors ##
|
418
433
|
|
419
434
|
[Brian Cardarella](https://twitter.com/bcardarella)
|
@@ -11,10 +11,10 @@
|
|
11
11
|
# Note: client_side_validation requires the error to be encapsulated within
|
12
12
|
# <label for="#{instance.send(:tag_id)}" class="message"></label>
|
13
13
|
#
|
14
|
-
# ActionView::Base.field_error_proc =
|
15
|
-
#
|
16
|
-
# %
|
14
|
+
# ActionView::Base.field_error_proc = proc do |html_tag, instance|
|
15
|
+
# if html_tag =~ /^<label/
|
16
|
+
# %(<div class="field_with_errors">#{html_tag}</div>).html_safe
|
17
17
|
# else
|
18
|
-
# %
|
18
|
+
# %(<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>).html_safe
|
19
19
|
# end
|
20
20
|
# end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/*!
|
3
|
-
* Client Side Validations - v8.0.
|
3
|
+
* Client Side Validations - v8.0.2 (https://github.com/DavyJonesLocker/client_side_validations)
|
4
4
|
* Copyright (c) 2017 Geremia Taglialatela, Brian Cardarella
|
5
5
|
* Licensed under MIT (http://opensource.org/licenses/mit-license.php)
|
6
6
|
*/
|
@@ -597,7 +597,7 @@
|
|
597
597
|
|
598
598
|
window.ClientSideValidations.event = (window.Turbolinks != null) && window.Turbolinks.supported ? window.Turbolinks.EVENTS != null ? 'page:change' : 'turbolinks:load' : 'ready';
|
599
599
|
|
600
|
-
$(document).
|
600
|
+
$(document).on(window.ClientSideValidations.event, function() {
|
601
601
|
ClientSideValidations.disableValidators();
|
602
602
|
return $(ClientSideValidations.selectors.forms).validate();
|
603
603
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: client_side_validations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geremia Taglialatela
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-01-
|
12
|
+
date: 2017-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|