client_side_validations 4.2.1 → 6.0.0
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 +71 -0
- data/README.md +32 -25
- data/lib/client_side_validations/action_view/form_builder.rb +37 -49
- data/lib/client_side_validations/action_view/form_helper.rb +10 -6
- data/lib/client_side_validations/action_view.rb +1 -1
- data/lib/client_side_validations/active_model/conditionals.rb +41 -0
- data/lib/client_side_validations/active_model/numericality.rb +1 -1
- data/lib/client_side_validations/active_model.rb +10 -15
- data/lib/client_side_validations/active_record/middleware.rb +22 -13
- data/lib/client_side_validations/active_record.rb +5 -6
- data/lib/client_side_validations/generators.rb +1 -1
- data/lib/client_side_validations/middleware.rb +2 -2
- data/lib/client_side_validations/version.rb +1 -1
- data/vendor/assets/javascripts/rails.validations.js +32 -31
- metadata +60 -69
- data/HISTORY.md +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62857994d1326cfb20a2c2d3c1c5fd746fa72065
|
|
4
|
+
data.tar.gz: 5d187e21b9b0b8935f3d5bfee8099095a128a389
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 284d47098c63a20c73aad2d252028e54ecd7b519d6130d16170206440e4f70b6e28f70be895a71c4f71dc555acf65765f1137acbded5910aa5aea779bdf3862a
|
|
7
|
+
data.tar.gz: 4c0b3c38d2254184cd34841d87683a3c21e0e5c1805be57134b913078f96e964e920cf78b85efb41a214f9bb81721b24e3e78996ca82e2877e751d15717cb6b2
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 6.0.0 (2017-01-20)
|
|
4
|
+
|
|
5
|
+
* Rails 5.0 compatibility
|
|
6
|
+
|
|
7
|
+
## 4.2.12 (2017-01-19)
|
|
8
|
+
|
|
9
|
+
* Add Changelog ([#688](https://github.com/DavyJonesLocker/client_side_validations/issues/688))
|
|
10
|
+
* Test against jQuery from 1.7.2 to 3.1.1
|
|
11
|
+
* Drop Ruby 2.0.0 support
|
|
12
|
+
* Other minor changes
|
|
13
|
+
|
|
14
|
+
## 4.2.11 (2016-12-08)
|
|
15
|
+
|
|
16
|
+
* Fix conditional validators ([#686](https://github.com/DavyJonesLocker/client_side_validations/issues/686))
|
|
17
|
+
|
|
18
|
+
## 4.2.10 (2016-11-16)
|
|
19
|
+
|
|
20
|
+
* Fix dollar sign in regular expression ([#684](https://github.com/DavyJonesLocker/client_side_validations/issues/684))
|
|
21
|
+
|
|
22
|
+
## 4.2.9 (2016-11-11)
|
|
23
|
+
|
|
24
|
+
* Fix jQuery 3 compatibility
|
|
25
|
+
|
|
26
|
+
## 4.2.8 (2016-11-11)
|
|
27
|
+
|
|
28
|
+
* Fix numericality validator ([#679](https://github.com/DavyJonesLocker/client_side_validations/pull/679))
|
|
29
|
+
|
|
30
|
+
## 4.2.7 (2016-10-08)
|
|
31
|
+
|
|
32
|
+
* Fix: Prevent undesired `stopPropagation` on `focusout` event ([#675](https://github.com/DavyJonesLocker/client_side_validations/pull/675))
|
|
33
|
+
|
|
34
|
+
## 4.2.6 (2016-09-10)
|
|
35
|
+
|
|
36
|
+
* Add some clarity to the `copy_assets` command ([#671](https://github.com/DavyJonesLocker/client_side_validations/pull/671))
|
|
37
|
+
* Other minor changes
|
|
38
|
+
|
|
39
|
+
## 4.2.5 (2016-07-06)
|
|
40
|
+
|
|
41
|
+
* Fix: Make helpers consistent with their Rails counterparts ([#665](https://github.com/DavyJonesLocker/client_side_validations/issues/665))
|
|
42
|
+
* Other minor changes
|
|
43
|
+
|
|
44
|
+
## 4.2.4 (2016-06-14)
|
|
45
|
+
|
|
46
|
+
* Add Turbolinks 5 compatibility
|
|
47
|
+
* Drop Ruby 1.9 support
|
|
48
|
+
* Test against Ruby 2.1.10, 2.2.5 and 2.3.1
|
|
49
|
+
* Test against jQuery 1.12.4
|
|
50
|
+
|
|
51
|
+
## 4.2.3 (2016-03-14)
|
|
52
|
+
|
|
53
|
+
* Test against jQuery 1.12.1
|
|
54
|
+
* Other minor changes
|
|
55
|
+
|
|
56
|
+
## 4.2.2 (2016-02-28)
|
|
57
|
+
|
|
58
|
+
* Fix uniqueness validator data disclosure ([#648](https://github.com/DavyJonesLocker/client_side_validations/issues/648))
|
|
59
|
+
* Fix config.root_path to work in middleware ([#598](https://github.com/DavyJonesLocker/client_side_validations/pull/598))
|
|
60
|
+
* Other minor changes
|
|
61
|
+
|
|
62
|
+
## 4.2.1 (2016-01-15)
|
|
63
|
+
|
|
64
|
+
* Test against jQuery 1.12.0
|
|
65
|
+
* Other minor changes
|
|
66
|
+
|
|
67
|
+
## 4.2.0 (2016-01-07)
|
|
68
|
+
|
|
69
|
+
* First Rails 4.x compatible version
|
|
70
|
+
|
|
71
|
+
For older versions, please refer to [GitHub releases](https://github.com/DavyJonesLocker/client_side_validations/releases)
|
data/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
[](https://travis-ci.org/DavyJonesLocker/client_side_validations)
|
|
5
5
|
[](https://gemnasium.com/DavyJonesLocker/client_side_validations)
|
|
6
6
|
[](https://codeclimate.com/github/DavyJonesLocker/client_side_validations)
|
|
7
|
-
[](https://coveralls.io/
|
|
7
|
+
[](https://coveralls.io/github/DavyJonesLocker/client_side_validations?branch=master)
|
|
8
8
|
|
|
9
|
-
`ClientSideValidations` made easy for your Rails
|
|
9
|
+
`ClientSideValidations` made easy for your Rails 5 applications!
|
|
10
10
|
|
|
11
11
|
## Project Goals ##
|
|
12
12
|
|
|
13
|
-
1. Follow the best practices for client side validations developed by [Luke Wroblewski](http://
|
|
13
|
+
1. Follow the best practices for client side validations developed by [Luke Wroblewski](http://alistapart.com/article/inline-validation-in-web-forms)
|
|
14
14
|
2. Automatically extract and apply validation rules defined on the
|
|
15
15
|
server to the client.
|
|
16
16
|
3. In the cases where a server-side validation rule would not work on
|
|
@@ -46,11 +46,12 @@ This will install the initializer:
|
|
|
46
46
|
config/initializers/client_side_validations.rb
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
If you
|
|
49
|
+
If you need to copy the asset files from the gem into your project:
|
|
50
50
|
|
|
51
51
|
```
|
|
52
52
|
rails g client_side_validations:copy_assets
|
|
53
53
|
```
|
|
54
|
+
Note: If you run `copy_assets`, you will need to run it again each time you update this project.
|
|
54
55
|
|
|
55
56
|
## Initializer ##
|
|
56
57
|
|
|
@@ -70,10 +71,10 @@ There is additional support for other `ActiveModel` based ORMs and other
|
|
|
70
71
|
Rails `FormBuilders`. Please see the [Plugin wiki page](https://github.com/DavyJonesLocker/client_side_validations/wiki/Plugins)
|
|
71
72
|
(feel free to add your own)
|
|
72
73
|
|
|
73
|
-
* [SimpleForm](https://github.com/
|
|
74
|
-
* [Formtastic](https://github.com/
|
|
75
|
-
* [Mongoid](https://github.com/
|
|
76
|
-
* [MongoMapper](https://github.com/
|
|
74
|
+
* [SimpleForm](https://github.com/DavyJonesLocker/client_side_validations-simple_form)
|
|
75
|
+
* [Formtastic](https://github.com/DavyJonesLocker/client_side_validations-formtastic)
|
|
76
|
+
* [Mongoid](https://github.com/DavyJonesLocker/client_side_validations-mongoid)
|
|
77
|
+
* [MongoMapper](https://github.com/DavyJonesLocker/client_side_validations-mongo_mapper)
|
|
77
78
|
|
|
78
79
|
## Usage ##
|
|
79
80
|
|
|
@@ -142,7 +143,24 @@ individual validators:
|
|
|
142
143
|
|
|
143
144
|
In the above case only the `presence` validator will be passed to the client.
|
|
144
145
|
|
|
145
|
-
This is also the case with
|
|
146
|
+
This is also the case with [other supported conditional validations](http://guides.rubyonrails.org/v4.2.0/active_record_validations.html#conditional-validation) (such as Procs, Arrays or Strings).
|
|
147
|
+
|
|
148
|
+
**NOTE:** when `:if` conditional includes a symbol or a string with
|
|
149
|
+
`changed?` in it, validator will forced automatically.
|
|
150
|
+
|
|
151
|
+
```ruby
|
|
152
|
+
class Person < ActiveRecord::Base
|
|
153
|
+
validates :name, presence: true, if: :name_changed?
|
|
154
|
+
end
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The presence of name in the example above will be validated
|
|
158
|
+
without explicit forcing.
|
|
159
|
+
|
|
160
|
+
This is done because it is always assumed the value will change on the
|
|
161
|
+
form.
|
|
162
|
+
|
|
163
|
+
Conditionals defined with `:unless` key do not have this optimization.
|
|
146
164
|
|
|
147
165
|
### Turning off validators ###
|
|
148
166
|
|
|
@@ -504,9 +522,9 @@ Note that the `FormBuilder` will automatically skip building validators that are
|
|
|
504
522
|
|
|
505
523
|
## Authors ##
|
|
506
524
|
|
|
507
|
-
[Brian Cardarella](
|
|
525
|
+
[Brian Cardarella](https://twitter.com/bcardarella)
|
|
508
526
|
|
|
509
|
-
[Geremia Taglialatela](
|
|
527
|
+
[Geremia Taglialatela](https://twitter.com/gtagliala)
|
|
510
528
|
|
|
511
529
|
[We are very thankful for the many contributors](https://github.com/DavyJonesLocker/client_side_validations/graphs/contributors)
|
|
512
530
|
|
|
@@ -514,17 +532,6 @@ Note that the `FormBuilder` will automatically skip building validators that are
|
|
|
514
532
|
|
|
515
533
|
This gem follows [Semantic Versioning](http://semver.org)
|
|
516
534
|
|
|
517
|
-
Major and minor version numbers will follow `Rails`'s major and
|
|
518
|
-
minor version numbers. For example,
|
|
519
|
-
`client_side_validations-4.2.0` will be compatible up to
|
|
520
|
-
`~> rails-4.2.0`
|
|
521
|
-
|
|
522
|
-
We will maintain compatibility with one minor version back. So the 4.2.0 version of `client_side_validations`
|
|
523
|
-
will be compatible with `~> rails-4.1.0`. We will not drop support
|
|
524
|
-
to older versions if not necessary.
|
|
525
|
-
|
|
526
|
-
Only two versions minor versions will be actively maintained.
|
|
527
|
-
|
|
528
535
|
## Want to help? ##
|
|
529
536
|
|
|
530
537
|
Please do! We are always looking to improve this gem. Please see our
|
|
@@ -533,8 +540,8 @@ on how to properly submit issues and pull requests.
|
|
|
533
540
|
|
|
534
541
|
## Legal ##
|
|
535
542
|
|
|
536
|
-
[DockYard](
|
|
543
|
+
[DockYard](https://dockyard.com/), LLC © 2012-2017
|
|
537
544
|
|
|
538
|
-
[@dockyard](
|
|
545
|
+
[@dockyard](https://twitter.com/dockyard)
|
|
539
546
|
|
|
540
|
-
[Licensed under the MIT license](
|
|
547
|
+
[Licensed under the MIT license](https://opensource.org/licenses/mit-license.php)
|
|
@@ -2,30 +2,21 @@ module ClientSideValidations
|
|
|
2
2
|
module ActionView
|
|
3
3
|
module Helpers
|
|
4
4
|
module FormBuilder
|
|
5
|
-
def self.
|
|
5
|
+
def self.prepended(base)
|
|
6
6
|
(base.field_helpers.map(&:to_s) - %w(apply_form_for_options! label check_box radio_button fields_for hidden_field)).each do |selector|
|
|
7
7
|
base.class_eval <<-RUBY_EVAL
|
|
8
|
-
def #{selector}
|
|
8
|
+
def #{selector}(method, options = {})
|
|
9
9
|
build_validation_options(method, options)
|
|
10
10
|
options.delete(:validate)
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
# Cannot call super here, override the whole method
|
|
13
|
+
@template.send( # @template.send(
|
|
14
|
+
#{selector.inspect}, # "text_field",
|
|
15
|
+
@object_name, # @object_name,
|
|
16
|
+
method, # method,
|
|
17
|
+
objectify_options(options)) # objectify_options(options))
|
|
12
18
|
end
|
|
13
19
|
RUBY_EVAL
|
|
14
|
-
|
|
15
|
-
base.class_eval { alias_method_chain selector, :client_side_validations }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
base.class_eval do
|
|
19
|
-
alias_method_chain :initialize, :client_side_validations
|
|
20
|
-
alias_method_chain :fields_for, :client_side_validations
|
|
21
|
-
alias_method_chain :check_box, :client_side_validations
|
|
22
|
-
alias_method_chain :radio_button, :client_side_validations
|
|
23
|
-
alias_method_chain :select, :client_side_validations
|
|
24
|
-
alias_method_chain :collection_select, :client_side_validations
|
|
25
|
-
alias_method_chain :collection_check_boxes, :client_side_validations
|
|
26
|
-
alias_method_chain :collection_radio_buttons, :client_side_validations
|
|
27
|
-
alias_method_chain :grouped_collection_select, :client_side_validations
|
|
28
|
-
alias_method_chain :time_zone_select, :client_side_validations
|
|
29
20
|
end
|
|
30
21
|
end
|
|
31
22
|
|
|
@@ -45,63 +36,58 @@ module ClientSideValidations
|
|
|
45
36
|
nil
|
|
46
37
|
end
|
|
47
38
|
|
|
48
|
-
def
|
|
49
|
-
|
|
39
|
+
def initialize(object_name, object, template, options)
|
|
40
|
+
super(object_name, object, template, options)
|
|
50
41
|
@options[:validators] = { object => {} }
|
|
51
42
|
end
|
|
52
43
|
|
|
53
|
-
def
|
|
54
|
-
options
|
|
55
|
-
|
|
56
|
-
fields_for_without_client_side_validations(record_or_name_or_array, *(args << options), &block)
|
|
44
|
+
def fields_for(record_name, record_object = nil, fields_options = {}, &block)
|
|
45
|
+
fields_options[:validate] ||= @options[:validate] if @options[:validate] && !fields_options.key?(:validate)
|
|
46
|
+
super(record_name, record_object, fields_options, &block)
|
|
57
47
|
end
|
|
58
48
|
|
|
59
|
-
def
|
|
49
|
+
def check_box(method, options = {}, checked_value = '1', unchecked_value = '0')
|
|
60
50
|
build_validation_options(method, options)
|
|
61
51
|
options.delete(:validate)
|
|
62
|
-
|
|
52
|
+
super(method, options, checked_value, unchecked_value)
|
|
63
53
|
end
|
|
64
54
|
|
|
65
|
-
def
|
|
55
|
+
def radio_button(method, tag_value, options = {})
|
|
66
56
|
build_validation_options(method, options)
|
|
67
57
|
options.delete(:validate)
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def select_with_client_side_validations(method, choices, options = {}, html_options = {}, &block)
|
|
72
|
-
build_validation_options(method, html_options.merge(name: options[:name]))
|
|
73
|
-
html_options.delete(:validate)
|
|
74
|
-
select_without_client_side_validations(method, choices, options, html_options, &block)
|
|
58
|
+
super(method, tag_value, options)
|
|
75
59
|
end
|
|
76
60
|
|
|
77
|
-
def
|
|
61
|
+
def select(method, choices = nil, options = {}, html_options = {}, &block)
|
|
78
62
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
|
79
63
|
html_options.delete(:validate)
|
|
80
|
-
|
|
64
|
+
super(method, choices, options, html_options, &block)
|
|
81
65
|
end
|
|
82
66
|
|
|
83
|
-
def
|
|
67
|
+
def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
|
|
84
68
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
|
85
69
|
html_options.delete(:validate)
|
|
86
|
-
|
|
70
|
+
super(method, collection, value_method, text_method, options, html_options)
|
|
87
71
|
end
|
|
88
72
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
73
|
+
%i(collection_check_boxes collection_radio_buttons).each do |method_name|
|
|
74
|
+
define_method method_name do |method, collection, value_method, text_method, options = {}, html_options = {}, &block|
|
|
75
|
+
build_validation_options(method, html_options.merge(name: options[:name]))
|
|
76
|
+
html_options.delete(:validate)
|
|
77
|
+
super(method, collection, value_method, text_method, options, html_options, &block)
|
|
78
|
+
end
|
|
93
79
|
end
|
|
94
80
|
|
|
95
|
-
def
|
|
81
|
+
def grouped_collection_select(method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
|
|
96
82
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
|
97
83
|
html_options.delete(:validate)
|
|
98
|
-
|
|
84
|
+
super(method, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options)
|
|
99
85
|
end
|
|
100
86
|
|
|
101
|
-
def
|
|
87
|
+
def time_zone_select(method, priority_zones = nil, options = {}, html_options = {})
|
|
102
88
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
|
103
89
|
html_options.delete(:validate)
|
|
104
|
-
|
|
90
|
+
super(method, priority_zones, options, html_options)
|
|
105
91
|
end
|
|
106
92
|
|
|
107
93
|
private
|
|
@@ -109,11 +95,13 @@ module ClientSideValidations
|
|
|
109
95
|
def build_validation_options(method, options = {})
|
|
110
96
|
return unless @options[:validate]
|
|
111
97
|
|
|
112
|
-
index
|
|
113
|
-
name = options[:name] || "#{@object_name}#{index}[#{method}]"
|
|
98
|
+
index = @default_options[:index].present? ? "[#{@default_options[:index]}]" : ''
|
|
114
99
|
child_index = @options[:child_index] ? "(\\d+|#{Regexp.escape(@options[:child_index].to_s)})" : '\\d+'
|
|
100
|
+
|
|
101
|
+
name = options[:name] || "#{@object_name}#{index}[#{method}]"
|
|
115
102
|
name = name.to_s.gsub(/_attributes\]\[#{child_index}\]/, '_attributes][]')
|
|
116
|
-
name
|
|
103
|
+
name << '[]' if options[:multiple]
|
|
104
|
+
|
|
117
105
|
@options[:validators][@object][method] = { name: name, options: options[:validate] }
|
|
118
106
|
end
|
|
119
107
|
end
|
|
@@ -7,7 +7,7 @@ module ClientSideValidations
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def form_for(record, options = {}, &block)
|
|
10
|
-
|
|
10
|
+
raise ArgumentError, 'Missing block' unless block_given?
|
|
11
11
|
if options[:validate]
|
|
12
12
|
|
|
13
13
|
# Always turn off HTML5 Validations
|
|
@@ -16,7 +16,7 @@ module ClientSideValidations
|
|
|
16
16
|
|
|
17
17
|
case record
|
|
18
18
|
when String, Symbol
|
|
19
|
-
|
|
19
|
+
raise ClientSideValidations::ActionView::Helpers::FormHelper::Error, 'Using form_for(:name, @resource) is not supported with ClientSideValidations. Please use form_for(@resource, as: :name) instead.'
|
|
20
20
|
else
|
|
21
21
|
object = record.is_a?(Array) ? record.last : record
|
|
22
22
|
object_name = options[:as] || model_name_from_record_or_class(object).param_key
|
|
@@ -38,17 +38,23 @@ module ClientSideValidations
|
|
|
38
38
|
# Would be nice to not do this
|
|
39
39
|
script = insert_validators_into_script(script)
|
|
40
40
|
|
|
41
|
+
# rubocop:disable OutputSafety
|
|
42
|
+
# TODO: check if html_safe is really needed here
|
|
41
43
|
if assign_script_to_content_for(options[:validate], script)
|
|
42
44
|
form.html_safe
|
|
43
45
|
else
|
|
44
46
|
"#{form}#{script}".html_safe
|
|
45
47
|
end
|
|
48
|
+
# rubocop:enable OutputSafety
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
def assign_script_to_content_for(name, script)
|
|
52
|
+
# rubocop:disable OutputSafety
|
|
53
|
+
# TODO: check if html_safe is really needed here
|
|
49
54
|
return unless name && name != true
|
|
50
|
-
content_for
|
|
55
|
+
content_for name, script.html_safe
|
|
51
56
|
true
|
|
57
|
+
# rubocop:enable OutputSafety
|
|
52
58
|
end
|
|
53
59
|
|
|
54
60
|
def apply_form_for_options!(record, object, options)
|
|
@@ -127,9 +133,7 @@ module ClientSideValidations
|
|
|
127
133
|
|
|
128
134
|
patterns = { numericality: "/^(-|\\+)?(?:\\d+|\\d{1,3}(?:\\#{number_format[:delimiter]}\\d{3})+)(?:\\#{number_format[:separator]}\\d*)?$/" }
|
|
129
135
|
|
|
130
|
-
|
|
131
|
-
"//<![CDATA[\nif(window.ClientSideValidations===undefined)window.ClientSideValidations={};window.ClientSideValidations.disabled_validators=#{ClientSideValidations::Config.disabled_validators.to_json};window.ClientSideValidations.number_format=#{number_format.to_json};if(window.ClientSideValidations.patterns===undefined)window.ClientSideValidations.patterns = {};window.ClientSideValidations.patterns.numericality=#{patterns[:numericality]};#{"if(window.ClientSideValidations.remote_validators_prefix===undefined)window.ClientSideValidations.remote_validators_prefix='#{ClientSideValidations::Config.root_path.sub(%r{/+\Z}, '')}';" if ClientSideValidations::Config.root_path.present?}if(window.ClientSideValidations.forms===undefined)window.ClientSideValidations.forms={};window.ClientSideValidations.forms['#{var_name}'] = #{builder.client_side_form_settings(options, self).merge(validators: 'validator_hash').to_json};\n//]]>".html_safe
|
|
132
|
-
end
|
|
136
|
+
javascript_tag "if(window.ClientSideValidations===undefined)window.ClientSideValidations={};window.ClientSideValidations.disabled_validators=#{ClientSideValidations::Config.disabled_validators.to_json};window.ClientSideValidations.number_format=#{number_format.to_json};if(window.ClientSideValidations.patterns===undefined)window.ClientSideValidations.patterns = {};window.ClientSideValidations.patterns.numericality=#{patterns[:numericality]};#{"if(window.ClientSideValidations.remote_validators_prefix===undefined)window.ClientSideValidations.remote_validators_prefix='#{ClientSideValidations::Config.root_path.sub(%r{/+\Z}, '')}';" if ClientSideValidations::Config.root_path.present?}if(window.ClientSideValidations.forms===undefined)window.ClientSideValidations.forms={};window.ClientSideValidations.forms['#{var_name}'] = #{builder.client_side_form_settings(options, self).merge(validators: 'validator_hash').to_json};"
|
|
133
137
|
end
|
|
134
138
|
end
|
|
135
139
|
end
|
|
@@ -12,4 +12,4 @@ require 'client_side_validations/action_view/form_builder'
|
|
|
12
12
|
|
|
13
13
|
ActionView::Base.send(:include, ClientSideValidations::ActionView::Helpers::FormHelper)
|
|
14
14
|
ActionView::Base.send(:include, ClientSideValidations::ActionView::Helpers::FormTagHelper)
|
|
15
|
-
ActionView::Helpers::FormBuilder.send(:
|
|
15
|
+
ActionView::Helpers::FormBuilder.send(:prepend, ClientSideValidations::ActionView::Helpers::FormBuilder)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module ClientSideValidations
|
|
2
|
+
module ActiveModel
|
|
3
|
+
module Conditionals
|
|
4
|
+
private
|
|
5
|
+
|
|
6
|
+
def run_conditionals(conditionals, conditional_type)
|
|
7
|
+
Array.wrap(conditionals).all? do |conditional|
|
|
8
|
+
value = run_one_conditional(conditional)
|
|
9
|
+
if conditional_type == :unless
|
|
10
|
+
!value
|
|
11
|
+
else
|
|
12
|
+
value
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def run_one_conditional(conditional)
|
|
18
|
+
case conditional
|
|
19
|
+
when ::Proc
|
|
20
|
+
case conditional.arity
|
|
21
|
+
when 0
|
|
22
|
+
instance_exec(&conditional)
|
|
23
|
+
when 1
|
|
24
|
+
instance_exec(self, &conditional)
|
|
25
|
+
else
|
|
26
|
+
raise ArgumentError, 'Missing argument'
|
|
27
|
+
end
|
|
28
|
+
when String
|
|
29
|
+
# rubocop:disable Security/Eval'
|
|
30
|
+
l = eval "lambda { |value| #{conditional} }"
|
|
31
|
+
# rubocop:enable Security/Eval'
|
|
32
|
+
instance_exec(nil, &l)
|
|
33
|
+
when Symbol
|
|
34
|
+
send conditional
|
|
35
|
+
else
|
|
36
|
+
raise ArgumentError, "Unknown conditional #{conditional}. If supported by ActiveModel/ActiveRecord open a bug for client_side_validations gem."
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -4,7 +4,7 @@ module ClientSideValidations
|
|
|
4
4
|
@@option_map = {}
|
|
5
5
|
|
|
6
6
|
def self.included(base)
|
|
7
|
-
@@option_map.merge!(base::CHECKS.keys.inject({}) { |
|
|
7
|
+
@@option_map.merge!(base::CHECKS.keys.inject({}) { |acc, elem| acc.merge!(elem => elem) })
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def client_side_hash(model, attribute, force = nil)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'client_side_validations/core_ext'
|
|
2
|
+
require 'client_side_validations/active_model/conditionals'
|
|
2
3
|
|
|
3
4
|
module ClientSideValidations
|
|
4
5
|
module ActiveModel
|
|
@@ -23,12 +24,14 @@ module ClientSideValidations
|
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
module Validations
|
|
27
|
+
include ClientSideValidations::ActiveModel::Conditionals
|
|
28
|
+
|
|
26
29
|
def client_side_validation_hash(force = nil)
|
|
27
30
|
_validators.inject({}) do |attr_hash, attr|
|
|
28
31
|
return attr_hash if [nil, :block].include?(attr[0])
|
|
29
32
|
|
|
30
33
|
validator_hash = attr[1].each_with_object(Hash.new { |h, k| h[k] = [] }) do |validator, kind_hash|
|
|
31
|
-
next
|
|
34
|
+
next unless can_use_for_client_side_validation?(attr[0], validator, force)
|
|
32
35
|
|
|
33
36
|
client_side_hash = validator.client_side_hash(self, attr[0], extract_force_option(attr[0], force))
|
|
34
37
|
if client_side_hash
|
|
@@ -68,10 +71,10 @@ module ClientSideValidations
|
|
|
68
71
|
else
|
|
69
72
|
result = can_force_validator?(attr, validator, force)
|
|
70
73
|
if validator.options[:if]
|
|
71
|
-
result &&=
|
|
74
|
+
result &&= run_conditionals(validator.options[:if], :if)
|
|
72
75
|
end
|
|
73
76
|
if validator.options[:unless]
|
|
74
|
-
result &&=
|
|
77
|
+
result &&= run_conditionals(validator.options[:unless], :unless)
|
|
75
78
|
end
|
|
76
79
|
end
|
|
77
80
|
end
|
|
@@ -79,15 +82,8 @@ module ClientSideValidations
|
|
|
79
82
|
result
|
|
80
83
|
end
|
|
81
84
|
|
|
82
|
-
def run_conditional(method_name_value_or_proc)
|
|
83
|
-
if method_name_value_or_proc.respond_to?(:call)
|
|
84
|
-
method_name_value_or_proc.call self
|
|
85
|
-
else
|
|
86
|
-
send method_name_value_or_proc
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
85
|
def validator_turned_off?(attr, validator, force)
|
|
86
|
+
return true if ::ClientSideValidations::Config.disabled_validators.include?(validator.kind)
|
|
91
87
|
case force
|
|
92
88
|
when FalseClass
|
|
93
89
|
true
|
|
@@ -101,7 +97,7 @@ module ClientSideValidations
|
|
|
101
97
|
false
|
|
102
98
|
end
|
|
103
99
|
else
|
|
104
|
-
|
|
100
|
+
false
|
|
105
101
|
end
|
|
106
102
|
end
|
|
107
103
|
|
|
@@ -149,8 +145,7 @@ end
|
|
|
149
145
|
ActiveModel::Validator.send(:include, ClientSideValidations::ActiveModel::Validator)
|
|
150
146
|
ActiveModel::Validations.send(:include, ClientSideValidations::ActiveModel::Validations)
|
|
151
147
|
|
|
152
|
-
%w(
|
|
153
|
-
require "client_side_validations/active_model/#{validator}"
|
|
154
|
-
validator.capitalize!
|
|
148
|
+
%w(Absence Acceptance Exclusion Format Inclusion Length Numericality Presence).each do |validator|
|
|
149
|
+
require "client_side_validations/active_model/#{validator.downcase}"
|
|
155
150
|
ActiveModel::Validations.const_get("#{validator}Validator").send :include, ClientSideValidations::ActiveModel.const_get(validator)
|
|
156
151
|
end
|
|
@@ -6,16 +6,23 @@ module ClientSideValidations
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def self.unique?(klass, attribute, value, params)
|
|
9
|
-
klass
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
value
|
|
9
|
+
klass = find_topmost_superclass(klass)
|
|
10
|
+
connection = klass.connection
|
|
11
|
+
column = klass.columns_hash[attribute.to_s]
|
|
12
|
+
value = type_cast_value(connection, column, value)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
sql = sql_statement(klass, connection, attribute, value, params)
|
|
15
|
+
relation = Arel::Nodes::SqlLiteral.new(sql)
|
|
15
16
|
|
|
17
|
+
klass.where(relation).empty?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.sql_statement(klass, connection, attribute, value, params)
|
|
16
21
|
sql = []
|
|
22
|
+
t = klass.arel_table
|
|
23
|
+
|
|
17
24
|
if params[:case_sensitive] == 'true'
|
|
18
|
-
sql << 'BINARY' if
|
|
25
|
+
sql << 'BINARY' if connection.adapter_name =~ /^mysql/i
|
|
19
26
|
sql << t[attribute].eq(value).to_sql
|
|
20
27
|
else
|
|
21
28
|
escaped_value = value.gsub(/[%_]/, '\\\\\0')
|
|
@@ -25,19 +32,21 @@ module ClientSideValidations
|
|
|
25
32
|
sql << "AND #{t[klass.primary_key].not_eq(params[:id]).to_sql}" if params[:id]
|
|
26
33
|
|
|
27
34
|
(params[:scope] || {}).each do |scope_attribute, scope_value|
|
|
28
|
-
scope_value = type_cast_value(klass.columns_hash[scope_attribute], scope_value)
|
|
35
|
+
scope_value = type_cast_value(connection, klass.columns_hash[scope_attribute], scope_value)
|
|
29
36
|
sql << "AND #{t[scope_attribute].eq(scope_value).to_sql}"
|
|
30
37
|
end
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
!klass.where(relation).exists?
|
|
39
|
+
sql.join ' '
|
|
34
40
|
end
|
|
35
41
|
|
|
36
|
-
def self.type_cast_value(column, value)
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
def self.type_cast_value(connection, column, value)
|
|
43
|
+
type = connection.lookup_cast_type_from_column(column)
|
|
44
|
+
value = type.deserialize(value)
|
|
45
|
+
|
|
46
|
+
if column.limit && value.is_a?(String)
|
|
47
|
+
value.mb_chars[0, column.limit]
|
|
39
48
|
else
|
|
40
|
-
|
|
49
|
+
value
|
|
41
50
|
end
|
|
42
51
|
end
|
|
43
52
|
|
|
@@ -2,11 +2,10 @@ require 'client_side_validations/active_model'
|
|
|
2
2
|
require 'client_side_validations/middleware'
|
|
3
3
|
require 'client_side_validations/active_record/middleware'
|
|
4
4
|
|
|
5
|
-
%w(uniqueness).each do |validator|
|
|
6
|
-
require "client_side_validations/active_record/#{validator}"
|
|
7
|
-
validator.capitalize!
|
|
8
|
-
ActiveRecord::Validations.const_get("#{validator}Validator").send :include, ClientSideValidations::ActiveRecord.const_get(validator)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
5
|
ActiveRecord::Base.send(:include, ClientSideValidations::ActiveModel::Validations)
|
|
12
6
|
ClientSideValidations::Middleware::Uniqueness.register_orm(ClientSideValidations::ActiveRecord::Middleware)
|
|
7
|
+
|
|
8
|
+
%w(Uniqueness).each do |validator|
|
|
9
|
+
require "client_side_validations/active_record/#{validator.downcase}"
|
|
10
|
+
ActiveRecord::Validations.const_get("#{validator}Validator").send :include, ClientSideValidations::ActiveRecord.const_get(validator)
|
|
11
|
+
end
|
|
@@ -8,7 +8,7 @@ module ClientSideValidations
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def call(env)
|
|
11
|
-
matches = %r{\A/validators
|
|
11
|
+
matches = %r{\A/?#{ClientSideValidations::Config.root_path}/validators\/(\w+)\z}.match(env['PATH_INFO'])
|
|
12
12
|
if matches
|
|
13
13
|
process_request(matches.captures.first, env)
|
|
14
14
|
else
|
|
@@ -98,7 +98,7 @@ module ClientSideValidations
|
|
|
98
98
|
middleware_class = nil
|
|
99
99
|
|
|
100
100
|
unless Array.wrap(klass._validators[attribute.to_sym]).find { |v| v.kind == :uniqueness }
|
|
101
|
-
|
|
101
|
+
raise NotValidatable
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
registered_orms.each do |orm|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
|
-
* Client Side Validations -
|
|
4
|
-
* Copyright (c)
|
|
3
|
+
* Client Side Validations - v6.0.0 (https://github.com/DavyJonesLocker/client_side_validations)
|
|
4
|
+
* Copyright (c) 2017 Geremia Taglialatela, Brian Cardarella
|
|
5
5
|
* Licensed under MIT (http://opensource.org/licenses/mit-license.php)
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
for (validator_name in validators) {
|
|
57
57
|
validator = validators[validator_name];
|
|
58
58
|
if (validator_name.match("\\[" + captures[1] + "\\].*\\[\\]\\[" + captures[2] + "\\]$")) {
|
|
59
|
-
name = name.replace(/\[[\da-z_]+\]\[(\w+)\]$/g,
|
|
59
|
+
name = name.replace(/\[[\da-z_]+\]\[(\w+)\]$/g, '[][$1]');
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
};
|
|
119
119
|
if (element.attr('name').search(/\[([^\]]*?)\]$/) >= 0) {
|
|
120
120
|
destroyInputName = element.attr('name').replace(/\[([^\]]*?)\]$/, '[_destroy]');
|
|
121
|
-
if ($("input[name='" + destroyInputName + "']").val() ===
|
|
121
|
+
if ($("input[name='" + destroyInputName + "']").val() === '1') {
|
|
122
122
|
passElement();
|
|
123
123
|
return afterValidate();
|
|
124
124
|
}
|
|
@@ -191,25 +191,25 @@
|
|
|
191
191
|
'submit.ClientSideValidations': function(eventData) {
|
|
192
192
|
if (!$form.isValid(form.ClientSideValidations.settings.validators)) {
|
|
193
193
|
eventData.preventDefault();
|
|
194
|
-
|
|
194
|
+
eventData.stopImmediatePropagation();
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
197
|
'ajax:beforeSend.ClientSideValidations': function(eventData) {
|
|
198
198
|
if (eventData.target === this) {
|
|
199
|
-
|
|
199
|
+
$form.isValid(form.ClientSideValidations.settings.validators);
|
|
200
200
|
}
|
|
201
201
|
},
|
|
202
202
|
'form:validate:after.ClientSideValidations': function(eventData) {
|
|
203
|
-
|
|
203
|
+
ClientSideValidations.callbacks.form.after($form, eventData);
|
|
204
204
|
},
|
|
205
205
|
'form:validate:before.ClientSideValidations': function(eventData) {
|
|
206
|
-
|
|
206
|
+
ClientSideValidations.callbacks.form.before($form, eventData);
|
|
207
207
|
},
|
|
208
208
|
'form:validate:fail.ClientSideValidations': function(eventData) {
|
|
209
|
-
|
|
209
|
+
ClientSideValidations.callbacks.form.fail($form, eventData);
|
|
210
210
|
},
|
|
211
211
|
'form:validate:pass.ClientSideValidations': function(eventData) {
|
|
212
|
-
|
|
212
|
+
ClientSideValidations.callbacks.form.pass($form, eventData);
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
for (event in ref) {
|
|
@@ -227,28 +227,28 @@
|
|
|
227
227
|
$form = $(form);
|
|
228
228
|
ref = {
|
|
229
229
|
'focusout.ClientSideValidations': function() {
|
|
230
|
-
|
|
230
|
+
$(this).isValid(form.ClientSideValidations.settings.validators);
|
|
231
231
|
},
|
|
232
232
|
'change.ClientSideValidations': function() {
|
|
233
|
-
|
|
233
|
+
$(this).data('changed', true);
|
|
234
234
|
},
|
|
235
235
|
'element:validate:after.ClientSideValidations': function(eventData) {
|
|
236
|
-
|
|
236
|
+
ClientSideValidations.callbacks.element.after($(this), eventData);
|
|
237
237
|
},
|
|
238
238
|
'element:validate:before.ClientSideValidations': function(eventData) {
|
|
239
|
-
|
|
239
|
+
ClientSideValidations.callbacks.element.before($(this), eventData);
|
|
240
240
|
},
|
|
241
241
|
'element:validate:fail.ClientSideValidations': function(eventData, message) {
|
|
242
242
|
var element;
|
|
243
243
|
element = $(this);
|
|
244
|
-
|
|
244
|
+
ClientSideValidations.callbacks.element.fail(element, message, function() {
|
|
245
245
|
return form.ClientSideValidations.addError(element, message);
|
|
246
246
|
}, eventData);
|
|
247
247
|
},
|
|
248
248
|
'element:validate:pass.ClientSideValidations': function(eventData) {
|
|
249
249
|
var element;
|
|
250
250
|
element = $(this);
|
|
251
|
-
|
|
251
|
+
ClientSideValidations.callbacks.element.pass(element, function() {
|
|
252
252
|
return form.ClientSideValidations.removeError(element);
|
|
253
253
|
}, eventData);
|
|
254
254
|
}
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
}).on(event, binding);
|
|
261
261
|
}
|
|
262
262
|
$input.filter(':checkbox').on('change.ClientSideValidations', function() {
|
|
263
|
-
|
|
263
|
+
$(this).isValid(form.ClientSideValidations.settings.validators);
|
|
264
264
|
});
|
|
265
265
|
return $input.filter('[id$=_confirmation]').each(function() {
|
|
266
266
|
var confirmationElement, element, ref1, results;
|
|
@@ -269,10 +269,10 @@
|
|
|
269
269
|
if (element[0]) {
|
|
270
270
|
ref1 = {
|
|
271
271
|
'focusout.ClientSideValidations': function() {
|
|
272
|
-
|
|
272
|
+
element.data('changed', true).isValid(form.ClientSideValidations.settings.validators);
|
|
273
273
|
},
|
|
274
274
|
'keyup.ClientSideValidations': function() {
|
|
275
|
-
|
|
275
|
+
element.data('changed', true).isValid(form.ClientSideValidations.settings.validators);
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
results = [];
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
}
|
|
333
333
|
},
|
|
334
334
|
numericality: function(element, options) {
|
|
335
|
-
var CHECKS, check,
|
|
335
|
+
var CHECKS, check, checkValue, fn, form, operator, val;
|
|
336
336
|
val = $.trim(element.val());
|
|
337
337
|
if (!ClientSideValidations.patterns.numericality.test(val)) {
|
|
338
338
|
if (options.allow_blank === true && this.presence(element, {
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
}
|
|
343
343
|
return options.messages.numericality;
|
|
344
344
|
}
|
|
345
|
-
val = val.replace(new RegExp("\\" + ClientSideValidations.number_format.delimiter, 'g'),
|
|
345
|
+
val = val.replace(new RegExp("\\" + ClientSideValidations.number_format.delimiter, 'g'), '').replace(new RegExp("\\" + ClientSideValidations.number_format.separator, 'g'), '.');
|
|
346
346
|
if (options.only_integer && !/^[+-]?\d+$/.test(val)) {
|
|
347
347
|
return options.messages.only_integer;
|
|
348
348
|
}
|
|
@@ -359,14 +359,11 @@
|
|
|
359
359
|
if (!(options[check] != null)) {
|
|
360
360
|
continue;
|
|
361
361
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
} else if (form.find("[name*=" + options[check] + "]").size() === 1) {
|
|
365
|
-
check_value = form.find("[name*=" + options[check] + "]").val();
|
|
366
|
-
} else {
|
|
362
|
+
checkValue = !isNaN(parseFloat(options[check])) && isFinite(options[check]) ? options[check] : form.find("[name*=" + options[check] + "]").length === 1 ? form.find("[name*=" + options[check] + "]").val() : void 0;
|
|
363
|
+
if ((checkValue == null) || checkValue === '') {
|
|
367
364
|
return;
|
|
368
365
|
}
|
|
369
|
-
fn = new Function("return " + val + " " + operator + " " +
|
|
366
|
+
fn = new Function("return " + val + " " + operator + " " + checkValue);
|
|
370
367
|
if (!fn()) {
|
|
371
368
|
return options.messages[check];
|
|
372
369
|
}
|
|
@@ -472,7 +469,9 @@
|
|
|
472
469
|
}
|
|
473
470
|
},
|
|
474
471
|
confirmation: function(element, options) {
|
|
475
|
-
|
|
472
|
+
var regex;
|
|
473
|
+
regex = new RegExp("^" + (element.val()) + "$", options.case_sensitive ? '' : 'i');
|
|
474
|
+
if (!regex.test($("#" + (element.attr('id')) + "_confirmation").val())) {
|
|
476
475
|
return options.message;
|
|
477
476
|
}
|
|
478
477
|
},
|
|
@@ -487,7 +486,7 @@
|
|
|
487
486
|
if (name_prefix && name_suffix) {
|
|
488
487
|
form = element.closest('form');
|
|
489
488
|
valid = true;
|
|
490
|
-
form.find(
|
|
489
|
+
form.find(":input[name^=\"" + name_prefix + "\"][name$=\"" + name_suffix + "\"]").each(function() {
|
|
491
490
|
if ($(this).attr('name') !== name) {
|
|
492
491
|
if ($(this).val() === value) {
|
|
493
492
|
valid = false;
|
|
@@ -551,7 +550,7 @@
|
|
|
551
550
|
name = element.attr('name');
|
|
552
551
|
}
|
|
553
552
|
if (options['class']) {
|
|
554
|
-
name = options['class'] +
|
|
553
|
+
name = options['class'] + "[" + (name.split('[')[1]);
|
|
555
554
|
}
|
|
556
555
|
data[name] = element.val();
|
|
557
556
|
if ($.ajax({
|
|
@@ -653,7 +652,9 @@
|
|
|
653
652
|
}
|
|
654
653
|
};
|
|
655
654
|
|
|
656
|
-
|
|
655
|
+
window.ClientSideValidations.event = (window.Turbolinks != null) && window.Turbolinks.supported ? window.Turbolinks.EVENTS != null ? 'page:change' : 'turbolinks:load' : 'ready';
|
|
656
|
+
|
|
657
|
+
$(document).bind(window.ClientSideValidations.event, function() {
|
|
657
658
|
ClientSideValidations.disableValidators();
|
|
658
659
|
return $(ClientSideValidations.selectors.forms).validate();
|
|
659
660
|
});
|
metadata
CHANGED
|
@@ -1,75 +1,64 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: client_side_validations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
+
- Geremia Taglialatela
|
|
7
8
|
- Brian Cardarella
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: rails
|
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
|
16
17
|
requirements:
|
|
17
|
-
- - "
|
|
18
|
+
- - "~>"
|
|
18
19
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
20
|
-
- - "
|
|
20
|
+
version: 5.0.0
|
|
21
|
+
- - ">="
|
|
21
22
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
23
|
+
version: 5.0.0.1
|
|
23
24
|
type: :runtime
|
|
24
25
|
prerelease: false
|
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
27
|
requirements:
|
|
27
|
-
- - "
|
|
28
|
+
- - "~>"
|
|
28
29
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
30
|
-
- - "
|
|
30
|
+
version: 5.0.0
|
|
31
|
+
- - ">="
|
|
31
32
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
33
|
+
version: 5.0.0.1
|
|
33
34
|
- !ruby/object:Gem::Dependency
|
|
34
35
|
name: jquery-rails
|
|
35
36
|
requirement: !ruby/object:Gem::Requirement
|
|
36
37
|
requirements:
|
|
37
|
-
- - "
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: 3.1.2
|
|
40
|
-
- - "<"
|
|
38
|
+
- - "~>"
|
|
41
39
|
- !ruby/object:Gem::Version
|
|
42
|
-
version:
|
|
40
|
+
version: '4.2'
|
|
43
41
|
type: :runtime
|
|
44
42
|
prerelease: false
|
|
45
43
|
version_requirements: !ruby/object:Gem::Requirement
|
|
46
44
|
requirements:
|
|
47
|
-
- - "
|
|
48
|
-
- !ruby/object:Gem::Version
|
|
49
|
-
version: 3.1.2
|
|
50
|
-
- - "<"
|
|
45
|
+
- - "~>"
|
|
51
46
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
47
|
+
version: '4.2'
|
|
53
48
|
- !ruby/object:Gem::Dependency
|
|
54
49
|
name: js_regex
|
|
55
50
|
requirement: !ruby/object:Gem::Requirement
|
|
56
51
|
requirements:
|
|
57
52
|
- - "~>"
|
|
58
53
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '1.
|
|
60
|
-
- - ">="
|
|
61
|
-
- !ruby/object:Gem::Version
|
|
62
|
-
version: 1.0.9
|
|
54
|
+
version: '1.2'
|
|
63
55
|
type: :runtime
|
|
64
56
|
prerelease: false
|
|
65
57
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
58
|
requirements:
|
|
67
59
|
- - "~>"
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '1.
|
|
70
|
-
- - ">="
|
|
71
|
-
- !ruby/object:Gem::Version
|
|
72
|
-
version: 1.0.9
|
|
61
|
+
version: '1.2'
|
|
73
62
|
- !ruby/object:Gem::Dependency
|
|
74
63
|
name: appraisal
|
|
75
64
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -84,34 +73,48 @@ dependencies:
|
|
|
84
73
|
- - "~>"
|
|
85
74
|
- !ruby/object:Gem::Version
|
|
86
75
|
version: '2.1'
|
|
76
|
+
- !ruby/object:Gem::Dependency
|
|
77
|
+
name: byebug
|
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '9.0'
|
|
83
|
+
type: :development
|
|
84
|
+
prerelease: false
|
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '9.0'
|
|
87
90
|
- !ruby/object:Gem::Dependency
|
|
88
91
|
name: coveralls
|
|
89
92
|
requirement: !ruby/object:Gem::Requirement
|
|
90
93
|
requirements:
|
|
91
94
|
- - "~>"
|
|
92
95
|
- !ruby/object:Gem::Version
|
|
93
|
-
version: 0.8.
|
|
96
|
+
version: 0.8.18
|
|
94
97
|
type: :development
|
|
95
98
|
prerelease: false
|
|
96
99
|
version_requirements: !ruby/object:Gem::Requirement
|
|
97
100
|
requirements:
|
|
98
101
|
- - "~>"
|
|
99
102
|
- !ruby/object:Gem::Version
|
|
100
|
-
version: 0.8.
|
|
103
|
+
version: 0.8.18
|
|
101
104
|
- !ruby/object:Gem::Dependency
|
|
102
105
|
name: m
|
|
103
106
|
requirement: !ruby/object:Gem::Requirement
|
|
104
107
|
requirements:
|
|
105
108
|
- - "~>"
|
|
106
109
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: '1.
|
|
110
|
+
version: '1.5'
|
|
108
111
|
type: :development
|
|
109
112
|
prerelease: false
|
|
110
113
|
version_requirements: !ruby/object:Gem::Requirement
|
|
111
114
|
requirements:
|
|
112
115
|
- - "~>"
|
|
113
116
|
- !ruby/object:Gem::Version
|
|
114
|
-
version: '1.
|
|
117
|
+
version: '1.5'
|
|
115
118
|
- !ruby/object:Gem::Dependency
|
|
116
119
|
name: minitest
|
|
117
120
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -138,126 +141,112 @@ dependencies:
|
|
|
138
141
|
requirements:
|
|
139
142
|
- - "~>"
|
|
140
143
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: '1.
|
|
144
|
+
version: '1.2'
|
|
142
145
|
type: :development
|
|
143
146
|
prerelease: false
|
|
144
147
|
version_requirements: !ruby/object:Gem::Requirement
|
|
145
148
|
requirements:
|
|
146
149
|
- - "~>"
|
|
147
150
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: '1.
|
|
151
|
+
version: '1.2'
|
|
149
152
|
- !ruby/object:Gem::Dependency
|
|
150
|
-
name:
|
|
153
|
+
name: rake
|
|
151
154
|
requirement: !ruby/object:Gem::Requirement
|
|
152
155
|
requirements:
|
|
153
156
|
- - "~>"
|
|
154
157
|
- !ruby/object:Gem::Version
|
|
155
|
-
version:
|
|
158
|
+
version: '12.0'
|
|
156
159
|
type: :development
|
|
157
160
|
prerelease: false
|
|
158
161
|
version_requirements: !ruby/object:Gem::Requirement
|
|
159
162
|
requirements:
|
|
160
163
|
- - "~>"
|
|
161
164
|
- !ruby/object:Gem::Version
|
|
162
|
-
version:
|
|
165
|
+
version: '12.0'
|
|
163
166
|
- !ruby/object:Gem::Dependency
|
|
164
|
-
name:
|
|
167
|
+
name: rubocop
|
|
165
168
|
requirement: !ruby/object:Gem::Requirement
|
|
166
169
|
requirements:
|
|
167
170
|
- - "~>"
|
|
168
171
|
- !ruby/object:Gem::Version
|
|
169
|
-
version: 0.
|
|
172
|
+
version: 0.47.1
|
|
170
173
|
type: :development
|
|
171
174
|
prerelease: false
|
|
172
175
|
version_requirements: !ruby/object:Gem::Requirement
|
|
173
176
|
requirements:
|
|
174
177
|
- - "~>"
|
|
175
178
|
- !ruby/object:Gem::Version
|
|
176
|
-
version: 0.
|
|
179
|
+
version: 0.47.1
|
|
177
180
|
- !ruby/object:Gem::Dependency
|
|
178
|
-
name:
|
|
181
|
+
name: simplecov
|
|
179
182
|
requirement: !ruby/object:Gem::Requirement
|
|
180
183
|
requirements:
|
|
181
184
|
- - "~>"
|
|
182
185
|
- !ruby/object:Gem::Version
|
|
183
|
-
version:
|
|
186
|
+
version: 0.12.0
|
|
184
187
|
type: :development
|
|
185
188
|
prerelease: false
|
|
186
189
|
version_requirements: !ruby/object:Gem::Requirement
|
|
187
190
|
requirements:
|
|
188
191
|
- - "~>"
|
|
189
192
|
- !ruby/object:Gem::Version
|
|
190
|
-
version:
|
|
193
|
+
version: 0.12.0
|
|
191
194
|
- !ruby/object:Gem::Dependency
|
|
192
|
-
name:
|
|
195
|
+
name: sqlite3
|
|
193
196
|
requirement: !ruby/object:Gem::Requirement
|
|
194
197
|
requirements:
|
|
195
198
|
- - "~>"
|
|
196
199
|
- !ruby/object:Gem::Version
|
|
197
|
-
version: '
|
|
200
|
+
version: '1.3'
|
|
198
201
|
type: :development
|
|
199
202
|
prerelease: false
|
|
200
203
|
version_requirements: !ruby/object:Gem::Requirement
|
|
201
204
|
requirements:
|
|
202
205
|
- - "~>"
|
|
203
206
|
- !ruby/object:Gem::Version
|
|
204
|
-
version: '
|
|
207
|
+
version: '1.3'
|
|
205
208
|
- !ruby/object:Gem::Dependency
|
|
206
209
|
name: sinatra
|
|
207
210
|
requirement: !ruby/object:Gem::Requirement
|
|
208
211
|
requirements:
|
|
209
212
|
- - "~>"
|
|
210
213
|
- !ruby/object:Gem::Version
|
|
211
|
-
version:
|
|
214
|
+
version: 2.0.0.beta2
|
|
212
215
|
type: :development
|
|
213
216
|
prerelease: false
|
|
214
217
|
version_requirements: !ruby/object:Gem::Requirement
|
|
215
218
|
requirements:
|
|
216
219
|
- - "~>"
|
|
217
220
|
- !ruby/object:Gem::Version
|
|
218
|
-
version:
|
|
221
|
+
version: 2.0.0.beta2
|
|
219
222
|
- !ruby/object:Gem::Dependency
|
|
220
223
|
name: shotgun
|
|
221
224
|
requirement: !ruby/object:Gem::Requirement
|
|
222
225
|
requirements:
|
|
223
226
|
- - "~>"
|
|
224
227
|
- !ruby/object:Gem::Version
|
|
225
|
-
version: 0.9.
|
|
228
|
+
version: 0.9.2
|
|
226
229
|
type: :development
|
|
227
230
|
prerelease: false
|
|
228
231
|
version_requirements: !ruby/object:Gem::Requirement
|
|
229
232
|
requirements:
|
|
230
233
|
- - "~>"
|
|
231
234
|
- !ruby/object:Gem::Version
|
|
232
|
-
version: 0.9.
|
|
235
|
+
version: 0.9.2
|
|
233
236
|
- !ruby/object:Gem::Dependency
|
|
234
237
|
name: thin
|
|
235
238
|
requirement: !ruby/object:Gem::Requirement
|
|
236
239
|
requirements:
|
|
237
240
|
- - "~>"
|
|
238
241
|
- !ruby/object:Gem::Version
|
|
239
|
-
version: '1.
|
|
240
|
-
type: :development
|
|
241
|
-
prerelease: false
|
|
242
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
243
|
-
requirements:
|
|
244
|
-
- - "~>"
|
|
245
|
-
- !ruby/object:Gem::Version
|
|
246
|
-
version: '1.6'
|
|
247
|
-
- !ruby/object:Gem::Dependency
|
|
248
|
-
name: json
|
|
249
|
-
requirement: !ruby/object:Gem::Requirement
|
|
250
|
-
requirements:
|
|
251
|
-
- - "~>"
|
|
252
|
-
- !ruby/object:Gem::Version
|
|
253
|
-
version: '1.8'
|
|
242
|
+
version: '1.7'
|
|
254
243
|
type: :development
|
|
255
244
|
prerelease: false
|
|
256
245
|
version_requirements: !ruby/object:Gem::Requirement
|
|
257
246
|
requirements:
|
|
258
247
|
- - "~>"
|
|
259
248
|
- !ruby/object:Gem::Version
|
|
260
|
-
version: '1.
|
|
249
|
+
version: '1.7'
|
|
261
250
|
- !ruby/object:Gem::Dependency
|
|
262
251
|
name: coffee-script
|
|
263
252
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -272,14 +261,15 @@ dependencies:
|
|
|
272
261
|
- - "~>"
|
|
273
262
|
- !ruby/object:Gem::Version
|
|
274
263
|
version: '2.4'
|
|
275
|
-
description: Client Side Validations made easy for your Rails
|
|
264
|
+
description: Client Side Validations made easy for your Rails 5 applications
|
|
276
265
|
email:
|
|
266
|
+
- tagliala.dev@gmail.com
|
|
277
267
|
- bcardarella@gmail.com
|
|
278
268
|
executables: []
|
|
279
269
|
extensions: []
|
|
280
270
|
extra_rdoc_files: []
|
|
281
271
|
files:
|
|
282
|
-
-
|
|
272
|
+
- CHANGELOG.md
|
|
283
273
|
- README.md
|
|
284
274
|
- lib/client_side_validations.rb
|
|
285
275
|
- lib/client_side_validations/action_view.rb
|
|
@@ -289,6 +279,7 @@ files:
|
|
|
289
279
|
- lib/client_side_validations/active_model.rb
|
|
290
280
|
- lib/client_side_validations/active_model/absence.rb
|
|
291
281
|
- lib/client_side_validations/active_model/acceptance.rb
|
|
282
|
+
- lib/client_side_validations/active_model/conditionals.rb
|
|
292
283
|
- lib/client_side_validations/active_model/exclusion.rb
|
|
293
284
|
- lib/client_side_validations/active_model/format.rb
|
|
294
285
|
- lib/client_side_validations/active_model/inclusion.rb
|
|
@@ -332,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
332
323
|
version: '0'
|
|
333
324
|
requirements: []
|
|
334
325
|
rubyforge_project:
|
|
335
|
-
rubygems_version: 2.
|
|
326
|
+
rubygems_version: 2.6.8
|
|
336
327
|
signing_key:
|
|
337
328
|
specification_version: 4
|
|
338
329
|
summary: Client Side Validations
|
data/HISTORY.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# ClientSideValidation History
|
|
2
|
-
|
|
3
|
-
## Version 4.2
|
|
4
|
-
|
|
5
|
-
* [v4.2.1](https://github.com/DavyJonesLocker/client_side_validations/compare/v4.2.0...v4.2.1)
|
|
6
|
-
* [v4.2.0](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.2.6...v4.2.0)
|
|
7
|
-
|
|
8
|
-
## Version 3.2
|
|
9
|
-
|
|
10
|
-
* [v3.2.6](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.2.5...v3.2.6)
|
|
11
|
-
* [v3.2.5](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.2.4...v3.2.5)
|
|
12
|
-
* [v3.2.4](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.2.3...v3.2.4)
|
|
13
|
-
* [v3.2.3](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.2.2...v3.2.3)
|
|
14
|
-
* [v3.2.2](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.2.1...v3.2.2)
|
|
15
|
-
* [v3.2.1](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.2.0...v3.2.1)
|
|
16
|
-
* [v3.2.0](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.1.5...v3.2.0)
|
|
17
|
-
|
|
18
|
-
## Version 3.1
|
|
19
|
-
|
|
20
|
-
* [v3.1.5](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.1.4...v3.1.5)
|
|
21
|
-
* [v3.1.4](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.1.3...v3.1.4)
|
|
22
|
-
* [v3.1.3](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.1.2...v3.1.3)
|
|
23
|
-
* [v3.1.2](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.1.1...v3.1.2)
|
|
24
|
-
* [v3.1.1](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.1.0...v3.1.1)
|
|
25
|
-
* [v3.1.0](https://github.com/DavyJonesLocker/client_side_validations/compare/badf88aa6a09012900e9275bb01c80f4d19482ce...v3.1.0)
|
|
26
|
-
|
|
27
|
-
## Version 3.0
|
|
28
|
-
|
|
29
|
-
* [v3.0.13](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.12...v3.0.13)
|
|
30
|
-
* [v3.0.12](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.11...v3.0.12)
|
|
31
|
-
* [v3.0.11](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.10...v3.0.11)
|
|
32
|
-
* [v3.0.10](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.9...v3.0.10)
|
|
33
|
-
* [v3.0.9](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.8...v3.0.9)
|
|
34
|
-
* [v3.0.8](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.7...v3.0.8)
|
|
35
|
-
* [v3.0.7](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.6...v3.0.7)
|
|
36
|
-
* [v3.0.6](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.5...v3.0.6)
|
|
37
|
-
* [v3.0.5](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.4...v3.0.5)
|
|
38
|
-
* [v3.0.4](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.3...v3.0.4)
|
|
39
|
-
* [v3.0.3](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.2...v3.0.3)
|
|
40
|
-
* [v3.0.2](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.1...v3.0.2)
|
|
41
|
-
* [v3.0.1](https://github.com/DavyJonesLocker/client_side_validations/compare/v3.0.0...v3.0.1)
|
|
42
|
-
* [v3.0.0](https://github.com/DavyJonesLocker/client_side_validations/compare/4c6262702e513f1c4c063d36ccc88c0f3071199a...v3.0.0)
|
|
43
|
-
|
|
44
|
-
## Prior to Version 3.0
|
|
45
|
-
|
|
46
|
-
This gem was a re-write of the original [ClientSideValidationsgem](https://github.com/dnclabs/client_side_validations).
|
|
47
|
-
Versions were not tagged.
|