client_side_validations 19.1.1 → 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -2
- data/lib/client_side_validations/action_view/form_builder.rb +10 -10
- data/lib/client_side_validations/action_view/form_helper.rb +24 -29
- data/lib/client_side_validations/version.rb +1 -1
- data/vendor/assets/javascripts/rails.validations.js +5 -11
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d053793972cfeadf6eb418493b6290913f624536d45fd289e8186f6ed337906
|
4
|
+
data.tar.gz: 783525ab3929c02a6c3ac3af8a3fc5d0c5d549e7513fe46c56a4be8d320244e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e9f42f6a856f7ee3487ae38b552a881e7fca16fada4e11cb4027067fa0956c7c4623eb571bc0b6da6e69a0eb001b88f847ff1e0e268010cba9f7169d47ce3eb
|
7
|
+
data.tar.gz: c08fca1ba13d7bcc86e924d195950f1f05c52ba06defcb51ed287bffdd0b58a93db27734dbb61f8308c3393d2dc773146a2130388043736cebac725bbacbd312
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 20.0.0 / 2021-12-16
|
4
|
+
|
5
|
+
* [FEATURE] Add Rails 7 compatibility - POSSIBLE BREAKING CHANGE ([#862](https://github.com/DavyJonesLocker/client_side_validations/pull/862))
|
6
|
+
* [ENHANCEMENT] Update development dependencies
|
7
|
+
|
3
8
|
## 19.1.1 / 2021-11-15
|
4
9
|
|
5
10
|
* [ENHANCEMENT] Require MFA to publish gems
|
data/README.md
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/client_side_validations.svg)](https://badge.fury.io/rb/client_side_validations)
|
4
4
|
[![npm version](https://badge.fury.io/js/%40client-side-validations%2Fclient-side-validations.svg)](https://badge.fury.io/js/%40client-side-validations%2Fclient-side-validations)
|
5
|
-
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=client_side_validations&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=client_side_validations&package-manager=bundler&version-scheme=semver)
|
6
5
|
[![Ruby Build Status](https://github.com/DavyJonesLocker/client_side_validations/actions/workflows/ruby.yml/badge.svg)](https://github.com/DavyJonesLocker/client_side_validations/actions)
|
7
6
|
[![JavaScript Build Status](https://github.com/DavyJonesLocker/client_side_validations/actions/workflows/javascript.yml/badge.svg)](https://github.com/DavyJonesLocker/client_side_validations/actions)
|
8
7
|
[![Maintainability](https://api.codeclimate.com/v1/badges/9f9e8bb6edc92615f34e/maintainability)](https://codeclimate.com/github/DavyJonesLocker/client_side_validations/maintainability)
|
9
8
|
[![Coverage Status](https://coveralls.io/repos/github/DavyJonesLocker/client_side_validations/badge.svg?branch=main)](https://coveralls.io/github/DavyJonesLocker/client_side_validations?branch=main)
|
10
9
|
|
11
10
|
|
12
|
-
`ClientSideValidations` made easy for your Rails 5.2 /
|
11
|
+
`ClientSideValidations` made easy for your Rails 5.2 / 6.x / 7.0 applications!
|
13
12
|
|
14
13
|
## Project Goals ##
|
15
14
|
|
@@ -22,7 +22,7 @@ module ClientSideValidations
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def initialize(object_name, object, template, options)
|
25
|
-
super
|
25
|
+
super
|
26
26
|
@options[:validators] = { object => {} }
|
27
27
|
end
|
28
28
|
|
@@ -45,7 +45,7 @@ module ClientSideValidations
|
|
45
45
|
def check_box(method, options = {}, checked_value = '1', unchecked_value = '0')
|
46
46
|
build_validation_options(method, options)
|
47
47
|
options.delete(:validate)
|
48
|
-
super
|
48
|
+
super
|
49
49
|
end
|
50
50
|
|
51
51
|
%i[collection_check_boxes collection_radio_buttons].each do |method_name|
|
@@ -59,7 +59,7 @@ module ClientSideValidations
|
|
59
59
|
def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
|
60
60
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
61
61
|
html_options.delete(:validate)
|
62
|
-
super
|
62
|
+
super
|
63
63
|
end
|
64
64
|
|
65
65
|
def fields_for(record_name, record_object = nil, fields_options = {}, &block)
|
@@ -69,42 +69,42 @@ module ClientSideValidations
|
|
69
69
|
end
|
70
70
|
|
71
71
|
fields_options[:validate] ||= @options[:validate] if @options[:validate] && !fields_options.key?(:validate)
|
72
|
-
super
|
72
|
+
super
|
73
73
|
end
|
74
74
|
|
75
75
|
def fields(scope = nil, model: nil, **options, &block)
|
76
76
|
options[:validate] ||= @options[:validate] if @options[:validate] && !options.key?(:validate)
|
77
|
-
super
|
77
|
+
super
|
78
78
|
end
|
79
79
|
|
80
80
|
def file_field(method, options = {})
|
81
81
|
build_validation_options(method, options)
|
82
82
|
options.delete(:validate)
|
83
|
-
super
|
83
|
+
super
|
84
84
|
end
|
85
85
|
|
86
86
|
def grouped_collection_select(method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
|
87
87
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
88
88
|
html_options.delete(:validate)
|
89
|
-
super
|
89
|
+
super
|
90
90
|
end
|
91
91
|
|
92
92
|
def radio_button(method, tag_value, options = {})
|
93
93
|
build_validation_options(method, options)
|
94
94
|
options.delete(:validate)
|
95
|
-
super
|
95
|
+
super
|
96
96
|
end
|
97
97
|
|
98
98
|
def select(method, choices = nil, options = {}, html_options = {}, &block)
|
99
99
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
100
100
|
html_options.delete(:validate)
|
101
|
-
super
|
101
|
+
super
|
102
102
|
end
|
103
103
|
|
104
104
|
def time_zone_select(method, priority_zones = nil, options = {}, html_options = {})
|
105
105
|
build_validation_options(method, html_options.merge(name: options[:name]))
|
106
106
|
html_options.delete(:validate)
|
107
|
-
super
|
107
|
+
super
|
108
108
|
end
|
109
109
|
|
110
110
|
private
|
@@ -15,35 +15,41 @@ module ClientSideValidations
|
|
15
15
|
# So we basically reimplement the whole form_for method
|
16
16
|
raise ArgumentError, 'Missing block' unless block
|
17
17
|
|
18
|
-
|
18
|
+
options[:html] ||= {}
|
19
19
|
|
20
20
|
# Moving the switch statement to another method to
|
21
21
|
# lower complexity
|
22
|
-
|
22
|
+
model, object_name = check_record(record, options)
|
23
23
|
|
24
|
-
|
24
|
+
remote = options.delete(:remote)
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
output = capture(builder, &block)
|
30
|
-
html_options[:multipart] ||= builder.multipart?
|
26
|
+
if remote && !embed_authenticity_token_in_remote_forms && options[:authenticity_token].blank?
|
27
|
+
options[:authenticity_token] = false
|
28
|
+
end
|
31
29
|
|
32
|
-
|
30
|
+
options[:model] = model
|
31
|
+
options[:scope] = object_name
|
32
|
+
options[:local] = !remote
|
33
|
+
options[:skip_default_ids] = false
|
34
|
+
options[:allow_method_names_outside_object] = options.fetch(:allow_method_names_outside_object, false)
|
33
35
|
|
34
|
-
|
35
|
-
html_options = html_options_for_form(options[:url] || {}, html_options)
|
36
|
-
form_tag_with_body(html_options, output)
|
36
|
+
form_with(**options, &block)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
super
|
39
|
+
def apply_csv_form_for_options!(record, object, options)
|
41
40
|
options[:html][:validate] = true if options[:validate]
|
41
|
+
|
42
|
+
if method(:apply_form_for_options!).arity == 2
|
43
|
+
apply_form_for_options! object, options
|
44
|
+
else
|
45
|
+
apply_form_for_options! record, object, options
|
46
|
+
end
|
42
47
|
end
|
43
48
|
|
44
49
|
def fields_for(record_name, record_object = nil, options = {}, &block)
|
45
50
|
# Order matters here. Rails mutates the `options` object
|
46
|
-
|
51
|
+
builder = instantiate_builder(record_name, record_object, options)
|
52
|
+
output = capture(builder, &block)
|
47
53
|
|
48
54
|
build_bound_validators! options
|
49
55
|
|
@@ -61,10 +67,10 @@ module ClientSideValidations
|
|
61
67
|
raise ArgumentError, 'First argument in form cannot contain nil or be empty' unless object
|
62
68
|
|
63
69
|
object_name = options[:as] || model_name_from_record_or_class(object).param_key
|
64
|
-
|
70
|
+
apply_csv_form_for_options!(record, object, options)
|
65
71
|
end
|
66
72
|
|
67
|
-
[
|
73
|
+
[record, object_name]
|
68
74
|
end
|
69
75
|
|
70
76
|
def build_bound_validators!(options)
|
@@ -121,19 +127,8 @@ module ClientSideValidations
|
|
121
127
|
end
|
122
128
|
end
|
123
129
|
|
124
|
-
def apply_html_options!(options, html_options)
|
125
|
-
# Turn off HTML5 validations
|
126
|
-
html_options[:novalidate] = 'novalidate'
|
127
|
-
|
128
|
-
html_options[:data] = options.delete(:data) if options.key?(:data)
|
129
|
-
html_options[:remote] = options.delete(:remote) if options.key?(:remote)
|
130
|
-
html_options[:method] = options.delete(:method) if options.key?(:method)
|
131
|
-
html_options[:enforce_utf8] = options.delete(:enforce_utf8) if options.key?(:enforce_utf8)
|
132
|
-
html_options[:authenticity_token] = options.delete(:authenticity_token)
|
133
|
-
end
|
134
|
-
|
135
130
|
def apply_csv_html_options!(html_options, options, builder)
|
136
|
-
html_options.delete
|
131
|
+
html_options.delete 'validate'
|
137
132
|
|
138
133
|
csv_options = {
|
139
134
|
html_settings: builder.client_side_form_settings(options, self),
|
@@ -17,17 +17,11 @@
|
|
17
17
|
function _typeof(obj) {
|
18
18
|
"@babel/helpers - typeof";
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
_typeof = function (obj) {
|
26
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
27
|
-
};
|
28
|
-
}
|
29
|
-
|
30
|
-
return _typeof(obj);
|
20
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
21
|
+
return typeof obj;
|
22
|
+
} : function (obj) {
|
23
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
24
|
+
}, _typeof(obj);
|
31
25
|
}
|
32
26
|
|
33
27
|
var ClientSideValidations = {
|
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:
|
4
|
+
version: 20.0.0
|
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: 2021-
|
12
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '5.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '7.
|
23
|
+
version: '7.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '5.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '7.
|
33
|
+
version: '7.1'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: js_regex
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|