client_side_validations 4.2.4 → 4.2.5

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: dc3095ada6d732f685ae5a89448fb73f0bf67d2b
4
- data.tar.gz: 0a7a366e16a11fda003e4cc5a5e5fb1b88ed13f3
3
+ metadata.gz: e89eee9df86b52cd88e9502fb4586c8be6172702
4
+ data.tar.gz: 7454460a7844579521618c65aac3bfabd9516cf7
5
5
  SHA512:
6
- metadata.gz: 52b2a3c40f0f9ff9c165303989bd9a7ed52bbe0cf86ae019d56ed3f8b98e325672acb5bf239b70b5bfb33dd1134dbf56534389e2dddb46aed26f87602c70e0c0
7
- data.tar.gz: dca548a1b975ba6c80ed4c8e6726e8020dd7e3ffa13b807ae4f6245cd670247c5f4707467db238582c8a590398ea0ecfa131f84c0f9ef9f261c21f58111c8b8f
6
+ metadata.gz: f3cdbfecf0e2a4309b87fd50b6a2a03ab136cd091c5ae6fe6f343654bbfb907b7ec3382541b39558f8cfcbe7d3246b76543734ac69eb8366f1be0943c3b6d3c5
7
+ data.tar.gz: c45bdfbb956fbe411cd71faa370f071882d64ca4f8281fe636831ad43e587a107acb7b349cbcf22edce9f95248cf4c34d75aa15450c5866b4f1e632e3a3adfeb
data/HISTORY.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ## Version 4.2
4
4
 
5
+ * [v4.2.5](https://github.com/DavyJonesLocker/client_side_validations/compare/v4.2.4...v4.2.5)
5
6
  * [v4.2.4](https://github.com/DavyJonesLocker/client_side_validations/compare/v4.2.3...v4.2.4)
6
7
  * [v4.2.3](https://github.com/DavyJonesLocker/client_side_validations/compare/v4.2.2...v4.2.3)
7
8
  * [v4.2.2](https://github.com/DavyJonesLocker/client_side_validations/compare/v4.2.1...v4.2.2)
@@ -45,15 +45,14 @@ module ClientSideValidations
45
45
  nil
46
46
  end
47
47
 
48
- def initialize_with_client_side_validations(object_name, object, *args)
49
- initialize_without_client_side_validations(object_name, object, *args)
48
+ def initialize_with_client_side_validations(object_name, object, template, options)
49
+ initialize_without_client_side_validations(object_name, object, template, options)
50
50
  @options[:validators] = { object => {} }
51
51
  end
52
52
 
53
- def fields_for_with_client_side_validations(record_or_name_or_array, *args, &block)
54
- options = args.extract_options!
55
- options[:validate] ||= @options[:validate] if @options[:validate] && !options.key?(:validate)
56
- fields_for_without_client_side_validations(record_or_name_or_array, *(args << options), &block)
53
+ def fields_for_with_client_side_validations(record_name, record_object = nil, fields_options = {}, &block)
54
+ fields_options[:validate] ||= @options[:validate] if @options[:validate] && !fields_options.key?(:validate)
55
+ fields_for_without_client_side_validations(record_name, record_object, fields_options, &block)
57
56
  end
58
57
 
59
58
  def check_box_with_client_side_validations(method, options = {}, checked_value = '1', unchecked_value = '0')
@@ -68,7 +67,7 @@ module ClientSideValidations
68
67
  radio_button_without_client_side_validations(method, tag_value, options)
69
68
  end
70
69
 
71
- def select_with_client_side_validations(method, choices, options = {}, html_options = {}, &block)
70
+ def select_with_client_side_validations(method, choices = nil, options = {}, html_options = {}, &block)
72
71
  build_validation_options(method, html_options.merge(name: options[:name]))
73
72
  html_options.delete(:validate)
74
73
  select_without_client_side_validations(method, choices, options, html_options, &block)
@@ -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(name) { script.html_safe }
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
- content_tag(:script) do
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
@@ -3,7 +3,7 @@ module ClientSideValidations
3
3
  @@assets = []
4
4
 
5
5
  def self.register_assets(klass)
6
- @@assets.push(*klass.assets)
6
+ @@assets.concat(klass.assets)
7
7
  end
8
8
 
9
9
  def self.assets
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ClientSideValidations
3
- VERSION = '4.2.4'.freeze
3
+ VERSION = '4.2.5'.freeze
4
4
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*!
3
- * Client Side Validations - v4.2.4 (https://github.com/DavyJonesLocker/client_side_validations)
3
+ * Client Side Validations - v4.2.5 (https://github.com/DavyJonesLocker/client_side_validations)
4
4
  * Copyright (c) 2016 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: 4.2.4
4
+ version: 4.2.5
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: 2016-06-14 00:00:00.000000000 Z
12
+ date: 2016-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -85,20 +85,34 @@ dependencies:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
87
  version: '2.1'
88
+ - !ruby/object:Gem::Dependency
89
+ name: byebug
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '9.0'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '9.0'
88
102
  - !ruby/object:Gem::Dependency
89
103
  name: coveralls
90
104
  requirement: !ruby/object:Gem::Requirement
91
105
  requirements:
92
106
  - - "~>"
93
107
  - !ruby/object:Gem::Version
94
- version: 0.8.13
108
+ version: 0.8.14
95
109
  type: :development
96
110
  prerelease: false
97
111
  version_requirements: !ruby/object:Gem::Requirement
98
112
  requirements:
99
113
  - - "~>"
100
114
  - !ruby/object:Gem::Version
101
- version: 0.8.13
115
+ version: 0.8.14
102
116
  - !ruby/object:Gem::Dependency
103
117
  name: m
104
118
  requirement: !ruby/object:Gem::Requirement
@@ -167,28 +181,28 @@ dependencies:
167
181
  requirements:
168
182
  - - "~>"
169
183
  - !ruby/object:Gem::Version
170
- version: 0.40.0
184
+ version: 0.41.1
171
185
  type: :development
172
186
  prerelease: false
173
187
  version_requirements: !ruby/object:Gem::Requirement
174
188
  requirements:
175
189
  - - "~>"
176
190
  - !ruby/object:Gem::Version
177
- version: 0.40.0
191
+ version: 0.41.1
178
192
  - !ruby/object:Gem::Dependency
179
193
  name: simplecov
180
194
  requirement: !ruby/object:Gem::Requirement
181
195
  requirements:
182
196
  - - "~>"
183
197
  - !ruby/object:Gem::Version
184
- version: 0.11.2
198
+ version: 0.12.0
185
199
  type: :development
186
200
  prerelease: false
187
201
  version_requirements: !ruby/object:Gem::Requirement
188
202
  requirements:
189
203
  - - "~>"
190
204
  - !ruby/object:Gem::Version
191
- version: 0.11.2
205
+ version: 0.12.0
192
206
  - !ruby/object:Gem::Dependency
193
207
  name: sqlite3
194
208
  requirement: !ruby/object:Gem::Requirement
@@ -203,20 +217,6 @@ dependencies:
203
217
  - - "~>"
204
218
  - !ruby/object:Gem::Version
205
219
  version: '1.3'
206
- - !ruby/object:Gem::Dependency
207
- name: byebug
208
- requirement: !ruby/object:Gem::Requirement
209
- requirements:
210
- - - "~>"
211
- - !ruby/object:Gem::Version
212
- version: '9.0'
213
- type: :development
214
- prerelease: false
215
- version_requirements: !ruby/object:Gem::Requirement
216
- requirements:
217
- - - "~>"
218
- - !ruby/object:Gem::Version
219
- version: '9.0'
220
220
  - !ruby/object:Gem::Dependency
221
221
  name: sinatra
222
222
  requirement: !ruby/object:Gem::Requirement
@@ -259,20 +259,6 @@ dependencies:
259
259
  - - "~>"
260
260
  - !ruby/object:Gem::Version
261
261
  version: '1.7'
262
- - !ruby/object:Gem::Dependency
263
- name: json
264
- requirement: !ruby/object:Gem::Requirement
265
- requirements:
266
- - - "~>"
267
- - !ruby/object:Gem::Version
268
- version: '1.8'
269
- type: :development
270
- prerelease: false
271
- version_requirements: !ruby/object:Gem::Requirement
272
- requirements:
273
- - - "~>"
274
- - !ruby/object:Gem::Version
275
- version: '1.8'
276
262
  - !ruby/object:Gem::Dependency
277
263
  name: coffee-script
278
264
  requirement: !ruby/object:Gem::Requirement