client_side_validations 11.1.0 → 11.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.md +1 -1
- data/README.md +25 -0
- data/lib/client_side_validations/active_model.rb +2 -2
- data/lib/client_side_validations/generators/rails_validations.rb +1 -1
- data/lib/client_side_validations/version.rb +1 -1
- data/lib/generators/client_side_validations/install_generator.rb +1 -1
- data/vendor/assets/javascripts/rails.validations.js +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2814c3e8e47cf46a9418974c2cf94a415a5b607cbf77ce794b3aa7fe3d947c44
|
4
|
+
data.tar.gz: e0fd3b7974fa316ae2436116e405ad53b415884211bb13ac986bda0dc2be6aa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c9db5b1d80737509678f76b14cf90238ed1ead0f065f96251c410dda5e359660a84c74f88e7c175869572acdb245e403ac88050453831b678c006a2af85948
|
7
|
+
data.tar.gz: d21f2bd80335c5f20f387a3aa2a8cdb9991a76bee16b04d5c1186112b768daf7cb8b68761b970b505fe3a1690d55b980d68f3e1c087357066b6723a797e165e9
|
data/CHANGELOG.md
CHANGED
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2018 Geremia Taglialatela, Brian Cardarella
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -407,6 +407,31 @@ ClientSideValidations::Config.disabled_validators = [:presence]
|
|
407
407
|
|
408
408
|
Note that the `FormBuilder` will automatically skip building validators that are disabled.
|
409
409
|
|
410
|
+
## Manual validation ##
|
411
|
+
|
412
|
+
By default, ClientSideValidations will automatically validate the form.
|
413
|
+
|
414
|
+
If for some reason you would like to manually validate the form (for example you're working with a multi-step form), you can use the following approach:
|
415
|
+
|
416
|
+
```js
|
417
|
+
$input = $('#myInputField');
|
418
|
+
$form = $input.closest('form');
|
419
|
+
validators = $form[0].ClientSideValidations.settings.validators;
|
420
|
+
|
421
|
+
// Validate a single field
|
422
|
+
// It might not work for multiple inputs selected at once by `$input`
|
423
|
+
$input.isValid(validators);
|
424
|
+
|
425
|
+
// Validate the whole form
|
426
|
+
$form.isValid(validators);
|
427
|
+
```
|
428
|
+
|
429
|
+
To manually validate a single field, you may also trigger a focusout event:
|
430
|
+
|
431
|
+
```js
|
432
|
+
$('#myInputField').trigger('focusout');
|
433
|
+
```
|
434
|
+
|
410
435
|
## Authors ##
|
411
436
|
|
412
437
|
[Brian Cardarella](https://twitter.com/bcardarella)
|
@@ -11,8 +11,8 @@ module ClientSideValidations
|
|
11
11
|
build_client_side_hash(model, attribute, options.dup)
|
12
12
|
end
|
13
13
|
|
14
|
-
def copy_conditional_attributes(
|
15
|
-
%i[if unless].each { |key|
|
14
|
+
def copy_conditional_attributes(attribute_to, attribute_from)
|
15
|
+
%i[if unless].each { |key| attribute_to[key] = attribute_from[key] if attribute_from[key].present? }
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
@@ -5,7 +5,7 @@ module ClientSideValidations
|
|
5
5
|
class RailsValidations
|
6
6
|
def self.assets
|
7
7
|
[{
|
8
|
-
path: File.expand_path('
|
8
|
+
path: File.expand_path('../../../vendor/assets/javascripts', __dir__),
|
9
9
|
file: 'rails.validations.js'
|
10
10
|
}]
|
11
11
|
end
|
@@ -6,7 +6,7 @@ module ClientSideValidations
|
|
6
6
|
module Generators
|
7
7
|
class InstallGenerator < CopyAssetsGenerator
|
8
8
|
def copy_initializer
|
9
|
-
source_paths << File.expand_path('
|
9
|
+
source_paths << File.expand_path('../templates/client_side_validations', __dir__)
|
10
10
|
copy_file 'initializer.rb', 'config/initializers/client_side_validations.rb'
|
11
11
|
end
|
12
12
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/*!
|
3
|
-
* Client Side Validations - v11.1.
|
3
|
+
* Client Side Validations - v11.1.1 (https://github.com/DavyJonesLocker/client_side_validations)
|
4
4
|
* Copyright (c) 2018 Geremia Taglialatela, Brian Cardarella
|
5
5
|
* Licensed under MIT (http://opensource.org/licenses/mit-license.php)
|
6
6
|
*/
|
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: 11.1.
|
4
|
+
version: 11.1.1
|
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: 2018-
|
12
|
+
date: 2018-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -51,14 +51,14 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.2'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.2'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: appraisal
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,14 +93,14 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.11.0
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.11.0
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: m
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,28 +163,28 @@ dependencies:
|
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
166
|
+
version: 0.53.0
|
167
167
|
type: :development
|
168
168
|
prerelease: false
|
169
169
|
version_requirements: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
173
|
+
version: 0.53.0
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
175
|
name: simplecov
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
180
|
+
version: 0.16.1
|
181
181
|
type: :development
|
182
182
|
prerelease: false
|
183
183
|
version_requirements: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.
|
187
|
+
version: 0.16.1
|
188
188
|
- !ruby/object:Gem::Dependency
|
189
189
|
name: sqlite3
|
190
190
|
requirement: !ruby/object:Gem::Requirement
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
version: '0'
|
317
317
|
requirements: []
|
318
318
|
rubyforge_project:
|
319
|
-
rubygems_version: 2.7.
|
319
|
+
rubygems_version: 2.7.6
|
320
320
|
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: Client Side Validations
|