client_side_validations 3.0.12 → 3.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/client_side_validations.gemspec +2 -10
- data/lib/client_side_validations/action_view/form_builder.rb +26 -21
- data/lib/client_side_validations/active_record/middleware.rb +12 -2
- data/lib/client_side_validations/version.rb +1 -1
- data/test/action_view/cases/test_helpers.rb +65 -30
- data/test/active_record/cases/test_middleware.rb +16 -1
- data/test/active_record/models/user.rb +1 -1
- data/test/base_helper.rb +0 -1
- data/vendor/assets/javascripts/rails.validations.js +135 -134
- metadata +174 -128
@@ -23,20 +23,12 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency 'mongoid', '~> 2.0.0'
|
24
24
|
s.add_development_dependency 'mongo_mapper','~>0.9.0'
|
25
25
|
s.add_development_dependency 'mocha'
|
26
|
-
s.add_development_dependency 'simple_form'
|
27
|
-
s.add_development_dependency 'formtastic'
|
26
|
+
s.add_development_dependency 'simple_form', '~> 1.5.0'
|
27
|
+
s.add_development_dependency 'formtastic', '~> 1.2.0'
|
28
28
|
|
29
29
|
# For QUnit testing
|
30
30
|
s.add_development_dependency 'sinatra', '~> 1.0'
|
31
31
|
s.add_development_dependency 'shotgun'
|
32
32
|
s.add_development_dependency 'thin'
|
33
33
|
s.add_development_dependency 'json'
|
34
|
-
|
35
|
-
ruby_minor_version = RUBY_VERSION.split('.')[1].to_i
|
36
|
-
if ruby_minor_version == 8
|
37
|
-
s.add_development_dependency 'minitest'
|
38
|
-
s.add_development_dependency 'ruby-debug'
|
39
|
-
elsif ruby_minor_version == 9
|
40
|
-
s.add_development_dependency 'ruby-debug19'
|
41
|
-
end
|
42
34
|
end
|
@@ -78,33 +78,33 @@ module ClientSideValidations::ActionView::Helpers
|
|
78
78
|
private
|
79
79
|
|
80
80
|
def apply_client_side_validators(method, options = {})
|
81
|
-
if @options[:validate] && options[:validate] != false && validators = filter_validators(
|
81
|
+
if @options[:validate] && options[:validate] != false && validators = filter_validators(method, options[:validate])
|
82
82
|
options.merge!("data-validate" => true)
|
83
83
|
@options[:validators].merge!("#{@object_name}[#{method}]#{options[:multiple] ? "[]" : nil}" => validators)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def filter_validators(
|
88
|
-
if validators
|
89
|
-
|
90
|
-
|
87
|
+
def filter_validators(method, filters)
|
88
|
+
if validators = @object.client_side_validation_hash[method]
|
89
|
+
unfiltered_validators = validators.inject({}) do |unfiltered_validators, validator|
|
90
|
+
unfiltered_validators[validator.first] = validator.last
|
91
91
|
if has_filter_for_validator?(validator, filters)
|
92
92
|
if filter_validator?(validator, filters)
|
93
|
-
|
94
|
-
elsif force_validator_despite_conditional?(validator, filters) && !can_run_validator?(validator)
|
95
|
-
|
93
|
+
unfiltered_validators.delete(validator.first)
|
94
|
+
elsif force_validator_despite_conditional?(validator, filters) && !can_run_validator?(validator, method)
|
95
|
+
unfiltered_validators.delete(validator.first)
|
96
96
|
end
|
97
97
|
else
|
98
|
-
if validator.last
|
99
|
-
|
98
|
+
if (conditional = (validator.last[:if] || validator.last[:unless])) && conditional.is_a?(Symbol) && !conditional_method_is_change_method?(conditional, method)
|
99
|
+
unfiltered_validators.delete(validator.first)
|
100
100
|
end
|
101
101
|
end
|
102
|
-
|
103
|
-
|
104
|
-
|
102
|
+
unfiltered_validators[validator.first].delete(:if) if unfiltered_validators[validator.first]
|
103
|
+
unfiltered_validators[validator.first].delete(:unless) if unfiltered_validators[validator.first]
|
104
|
+
unfiltered_validators
|
105
105
|
end
|
106
106
|
|
107
|
-
|
107
|
+
unfiltered_validators.empty? ? nil : unfiltered_validators
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -120,33 +120,38 @@ module ClientSideValidations::ActionView::Helpers
|
|
120
120
|
filters == true || filters[validator.first] == true
|
121
121
|
end
|
122
122
|
|
123
|
-
def can_run_validator?(validator)
|
123
|
+
def can_run_validator?(validator, method)
|
124
124
|
result = true
|
125
|
-
if_result =
|
126
|
-
unless_result =
|
125
|
+
if_result = run_if_validator(validator.last[:if], method)
|
126
|
+
unless_result = run_unless_validator(validator.last[:unless], method)
|
127
127
|
result = result && if_result unless if_result.nil?
|
128
128
|
result = result && unless_result unless unless_result.nil?
|
129
129
|
result
|
130
130
|
end
|
131
131
|
|
132
|
-
def
|
132
|
+
def run_if_validator(conditional, method)
|
133
133
|
if conditional
|
134
134
|
if conditional.is_a?(Symbol)
|
135
|
-
!!@object.send(conditional)
|
135
|
+
conditional_method_is_change_method?(conditional, method) ? true : !!@object.send(conditional)
|
136
136
|
else
|
137
137
|
!!conditional.call(@object)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
def
|
142
|
+
def run_unless_validator(conditional, method)
|
143
143
|
if conditional
|
144
144
|
if conditional.is_a?(Symbol)
|
145
|
-
!@object.send(conditional)
|
145
|
+
conditional_method_is_change_method?(conditional, method) ? true : !@object.send(conditional)
|
146
146
|
else
|
147
147
|
!conditional.call(@object)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
151
|
+
|
152
|
+
def conditional_method_is_change_method?(conditional, method)
|
153
|
+
conditional.to_sym == "#{method}_changed?".to_sym
|
154
|
+
end
|
151
155
|
end
|
152
156
|
end
|
157
|
+
|
@@ -1,7 +1,10 @@
|
|
1
|
+
require 'debugger'
|
2
|
+
|
1
3
|
module ClientSideValidations::ActiveRecord
|
2
4
|
class Middleware
|
3
5
|
|
4
6
|
def self.is_unique?(klass, attribute, value, params)
|
7
|
+
value = type_cast_value(klass, attribute, value)
|
5
8
|
column = klass.columns_hash[attribute.to_s]
|
6
9
|
value = column.limit ? value.to_s.mb_chars[0, column.limit] : value.to_s if column.text?
|
7
10
|
|
@@ -23,11 +26,18 @@ module ClientSideValidations::ActiveRecord
|
|
23
26
|
relation = relation.and(t.primary_key.not_eq(params[:id])) if params[:id]
|
24
27
|
end
|
25
28
|
|
26
|
-
(params[:scope] || {}).each do |
|
27
|
-
|
29
|
+
(params[:scope] || {}).each do |attribute, value|
|
30
|
+
value = type_cast_value(klass, attribute, value)
|
31
|
+
relation = relation.and(t[attribute].eq(value))
|
28
32
|
end
|
29
33
|
|
30
34
|
!klass.where(relation).exists?
|
31
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def self.type_cast_value(klass, attribute, value)
|
40
|
+
klass.columns_hash[attribute].type_cast(value)
|
41
|
+
end
|
32
42
|
end
|
33
43
|
end
|
@@ -346,7 +346,7 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
346
346
|
assert_equal expected, output_buffer
|
347
347
|
end
|
348
348
|
|
349
|
-
def
|
349
|
+
def test_conditional_validators_should_be_filtered
|
350
350
|
hash = {
|
351
351
|
:cost => {
|
352
352
|
:presence => {
|
@@ -379,7 +379,7 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
379
379
|
assert_equal expected, output_buffer
|
380
380
|
end
|
381
381
|
|
382
|
-
def
|
382
|
+
def test_conditional_validator_filters_being_forced
|
383
383
|
hash = {
|
384
384
|
:cost => {
|
385
385
|
:presence => {
|
@@ -400,8 +400,44 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
400
400
|
@post.stubs(:can_validate?).returns(true)
|
401
401
|
@post.stubs(:client_side_validation_hash).returns(hash)
|
402
402
|
form_for(@post, :validate => true) do |f|
|
403
|
-
concat f.text_field(:cost)
|
404
|
-
concat f.text_field(:title)
|
403
|
+
concat f.text_field(:cost, :validate => true)
|
404
|
+
concat f.text_field(:title, :validate => true)
|
405
|
+
end
|
406
|
+
|
407
|
+
validators = {
|
408
|
+
'post[cost]' => {:presence => {:message => "can't be blank"}},
|
409
|
+
'post[title]' => {:presence => {:message => "can't be blank"}}
|
410
|
+
}
|
411
|
+
expected = whole_form("/posts/123", "edit_post_123", "edit_post", :method => "put", :validators => validators) do
|
412
|
+
%{<input data-validate="true" id="post_cost" name="post[cost]" size="30" type="text" />} +
|
413
|
+
%{<input data-validate="true" id="post_title" name="post[title]" size="30" type="text" />}
|
414
|
+
end
|
415
|
+
assert_equal expected, output_buffer
|
416
|
+
end
|
417
|
+
|
418
|
+
def test_conditional_validator_filters_being_forced_and_not_meeting_condition
|
419
|
+
hash = {
|
420
|
+
:cost => {
|
421
|
+
:presence => {
|
422
|
+
:message => "can't be blank",
|
423
|
+
:unless => :cannot_validate?
|
424
|
+
}
|
425
|
+
},
|
426
|
+
:title => {
|
427
|
+
:presence => {
|
428
|
+
:message => "can't be blank",
|
429
|
+
:if => :can_validate?
|
430
|
+
}
|
431
|
+
}
|
432
|
+
}
|
433
|
+
|
434
|
+
@post.title = nil
|
435
|
+
@post.stubs(:cannot_validate?).returns(true)
|
436
|
+
@post.stubs(:can_validate?).returns(false)
|
437
|
+
@post.stubs(:client_side_validation_hash).returns(hash)
|
438
|
+
form_for(@post, :validate => true) do |f|
|
439
|
+
concat f.text_field(:cost, :validate => true)
|
440
|
+
concat f.text_field(:title, :validate => true)
|
405
441
|
end
|
406
442
|
|
407
443
|
validators = {}
|
@@ -412,7 +448,7 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
412
448
|
assert_equal expected, output_buffer
|
413
449
|
end
|
414
450
|
|
415
|
-
def
|
451
|
+
def test_conditional_validator_filters_being_forced_individually
|
416
452
|
hash = {
|
417
453
|
:cost => {
|
418
454
|
:presence => {
|
@@ -433,8 +469,8 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
433
469
|
@post.stubs(:can_validate?).returns(true)
|
434
470
|
@post.stubs(:client_side_validation_hash).returns(hash)
|
435
471
|
form_for(@post, :validate => true) do |f|
|
436
|
-
concat f.text_field(:cost, :validate => true)
|
437
|
-
concat f.text_field(:title, :validate => true)
|
472
|
+
concat f.text_field(:cost, :validate => { :presence => true })
|
473
|
+
concat f.text_field(:title, :validate => { :presence => true })
|
438
474
|
end
|
439
475
|
|
440
476
|
validators = {
|
@@ -448,7 +484,7 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
448
484
|
assert_equal expected, output_buffer
|
449
485
|
end
|
450
486
|
|
451
|
-
def
|
487
|
+
def test_conditional_validator_filters_being_forced_and_not_meeting_condition_individually
|
452
488
|
hash = {
|
453
489
|
:cost => {
|
454
490
|
:presence => {
|
@@ -469,8 +505,8 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
469
505
|
@post.stubs(:can_validate?).returns(false)
|
470
506
|
@post.stubs(:client_side_validation_hash).returns(hash)
|
471
507
|
form_for(@post, :validate => true) do |f|
|
472
|
-
concat f.text_field(:cost, :validate => true)
|
473
|
-
concat f.text_field(:title, :validate => true)
|
508
|
+
concat f.text_field(:cost, :validate => { :presence => true })
|
509
|
+
concat f.text_field(:title, :validate => { :presence => true })
|
474
510
|
end
|
475
511
|
|
476
512
|
validators = {}
|
@@ -481,18 +517,18 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
481
517
|
assert_equal expected, output_buffer
|
482
518
|
end
|
483
519
|
|
484
|
-
def
|
520
|
+
def test_conditional_validator_filters_being_forced_with_procs
|
485
521
|
hash = {
|
486
522
|
:cost => {
|
487
523
|
:presence => {
|
488
524
|
:message => "can't be blank",
|
489
|
-
:unless =>
|
525
|
+
:unless => Proc.new { |post| post.cannot_validate? }
|
490
526
|
}
|
491
527
|
},
|
492
528
|
:title => {
|
493
529
|
:presence => {
|
494
530
|
:message => "can't be blank",
|
495
|
-
:if =>
|
531
|
+
:if => Proc.new { |post| post.can_validate? }
|
496
532
|
}
|
497
533
|
}
|
498
534
|
}
|
@@ -502,8 +538,8 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
502
538
|
@post.stubs(:can_validate?).returns(true)
|
503
539
|
@post.stubs(:client_side_validation_hash).returns(hash)
|
504
540
|
form_for(@post, :validate => true) do |f|
|
505
|
-
concat f.text_field(:cost, :validate =>
|
506
|
-
concat f.text_field(:title, :validate =>
|
541
|
+
concat f.text_field(:cost, :validate => true)
|
542
|
+
concat f.text_field(:title, :validate => true)
|
507
543
|
end
|
508
544
|
|
509
545
|
validators = {
|
@@ -517,58 +553,57 @@ class ClientSideValidations::ActionViewHelpersTest < ActionView::TestCase
|
|
517
553
|
assert_equal expected, output_buffer
|
518
554
|
end
|
519
555
|
|
520
|
-
def
|
556
|
+
def test_conditional_validator_ignored_when_using_changed_helpers
|
521
557
|
hash = {
|
522
558
|
:cost => {
|
523
559
|
:presence => {
|
524
560
|
:message => "can't be blank",
|
525
|
-
:unless => :
|
561
|
+
:unless => :cost_changed?
|
526
562
|
}
|
527
563
|
},
|
528
564
|
:title => {
|
529
565
|
:presence => {
|
530
566
|
:message => "can't be blank",
|
531
|
-
:if => :
|
567
|
+
:if => :title_changed?
|
532
568
|
}
|
533
569
|
}
|
534
570
|
}
|
535
571
|
|
536
572
|
@post.title = nil
|
537
|
-
@post.stubs(:cannot_validate?).returns(true)
|
538
|
-
@post.stubs(:can_validate?).returns(false)
|
539
573
|
@post.stubs(:client_side_validation_hash).returns(hash)
|
540
574
|
form_for(@post, :validate => true) do |f|
|
541
|
-
concat f.text_field(:cost
|
542
|
-
concat f.text_field(:title
|
575
|
+
concat f.text_field(:cost)
|
576
|
+
concat f.text_field(:title)
|
543
577
|
end
|
544
578
|
|
545
|
-
validators = {
|
579
|
+
validators = {
|
580
|
+
'post[cost]' => {:presence => {:message => "can't be blank"}},
|
581
|
+
'post[title]' => {:presence => {:message => "can't be blank"}}
|
582
|
+
}
|
546
583
|
expected = whole_form("/posts/123", "edit_post_123", "edit_post", :method => "put", :validators => validators) do
|
547
|
-
%{<input id="post_cost" name="post[cost]" size="30" type="text" />} +
|
548
|
-
%{<input id="post_title" name="post[title]" size="30" type="text" />}
|
584
|
+
%{<input data-validate="true" id="post_cost" name="post[cost]" size="30" type="text" />} +
|
585
|
+
%{<input data-validate="true" id="post_title" name="post[title]" size="30" type="text" />}
|
549
586
|
end
|
550
587
|
assert_equal expected, output_buffer
|
551
588
|
end
|
552
589
|
|
553
|
-
def
|
590
|
+
def test_conditional_validator_ignored_when_using_changed_helpers_and_forcing_validators
|
554
591
|
hash = {
|
555
592
|
:cost => {
|
556
593
|
:presence => {
|
557
594
|
:message => "can't be blank",
|
558
|
-
:unless =>
|
595
|
+
:unless => :cost_changed?
|
559
596
|
}
|
560
597
|
},
|
561
598
|
:title => {
|
562
599
|
:presence => {
|
563
600
|
:message => "can't be blank",
|
564
|
-
:if =>
|
601
|
+
:if => :title_changed?
|
565
602
|
}
|
566
603
|
}
|
567
604
|
}
|
568
605
|
|
569
606
|
@post.title = nil
|
570
|
-
@post.stubs(:cannot_validate?).returns(false)
|
571
|
-
@post.stubs(:can_validate?).returns(true)
|
572
607
|
@post.stubs(:client_side_validation_hash).returns(hash)
|
573
608
|
form_for(@post, :validate => true) do |f|
|
574
609
|
concat f.text_field(:cost, :validate => true)
|
@@ -171,5 +171,20 @@ class ClientSideValidationsActiveRecordMiddlewareTest < Test::Unit::TestCase
|
|
171
171
|
assert_equal 'false', last_response.body
|
172
172
|
assert last_response.ok?
|
173
173
|
end
|
174
|
-
end
|
175
174
|
|
175
|
+
def test_uniqueness_when_value_must_be_typecast
|
176
|
+
User.create(:active => false)
|
177
|
+
get '/validators/uniqueness.json', { 'user[active]' => 'false', 'case_sensitive' => true }
|
178
|
+
|
179
|
+
assert_equal 'false', last_response.body
|
180
|
+
assert last_response.ok?
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_uniqueness_when_scope_is_given_and_value_must_be_typecast
|
184
|
+
User.create(:email => 'user@test.com', :active => true)
|
185
|
+
get '/validators/uniqueness.json', { 'user[email]' => 'user@test.com', 'scope' => { 'active' => 'true' }, 'case_sensitive' => true }
|
186
|
+
|
187
|
+
assert_equal 'false', last_response.body
|
188
|
+
assert last_response.ok?
|
189
|
+
end
|
190
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
users_table = %{CREATE TABLE users (id INTEGER PRIMARY KEY, age INTEGER, name TEXT, email TEXT, title VARCHAR(5));}
|
1
|
+
users_table = %{CREATE TABLE users (id INTEGER PRIMARY KEY, age INTEGER, name TEXT, email TEXT, title VARCHAR(5), active BOOLEAN);}
|
2
2
|
ActiveRecord::Base.connection.execute(users_table)
|
3
3
|
|
4
4
|
class User < ActiveRecord::Base
|
data/test/base_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Rails 3 Client Side Validations - v3.0.
|
2
|
+
* Rails 3 Client Side Validations - v3.0.13
|
3
3
|
* https://github.com/bcardarlela/client_side_validations
|
4
4
|
*
|
5
5
|
* Copyright (c) 2011 Brian Cardarella
|
@@ -7,77 +7,76 @@
|
|
7
7
|
* http://www.opensource.org/licenses/mit-license.php
|
8
8
|
*/
|
9
9
|
|
10
|
-
(function($) {
|
11
|
-
$.fn.validate = function() {
|
12
|
-
return this.filter('form[data-validate]').each(function() {
|
13
|
-
var form = $(this)
|
14
|
-
|
10
|
+
(function ($) {
|
11
|
+
$.fn.validate = function () {
|
12
|
+
return this.filter('form[data-validate]').each(function () {
|
13
|
+
var form = $(this),
|
14
|
+
settings = window[form.attr('id')],
|
15
|
+
addError = function (element, message) {
|
16
|
+
clientSideValidations.formBuilders[settings.type].add(element, settings, message);
|
17
|
+
},
|
18
|
+
removeError = function (element) {
|
19
|
+
clientSideValidations.formBuilders[settings.type].remove(element, settings);
|
20
|
+
};
|
15
21
|
|
16
22
|
// Set up the events for the form
|
17
23
|
form
|
18
|
-
.submit(function() { return form.isValid(settings.validators); })
|
19
|
-
.bind('ajax:beforeSend', function() { return form.isValid(settings.validators); })
|
24
|
+
.submit(function () { return form.isValid(settings.validators); })
|
25
|
+
.bind('ajax:beforeSend', function () { return form.isValid(settings.validators); } )
|
20
26
|
// Callbacks
|
21
|
-
.bind('form:validate:after', function(eventData) { clientSideValidations.callbacks.form.after( form, eventData); })
|
22
|
-
.bind('form:validate:before', function(eventData) { clientSideValidations.callbacks.form.before(form, eventData); })
|
23
|
-
.bind('form:validate:fail', function(eventData) { clientSideValidations.callbacks.form.fail( form, eventData); })
|
24
|
-
.bind('form:validate:pass', function(eventData) { clientSideValidations.callbacks.form.pass( form, eventData); })
|
27
|
+
.bind('form:validate:after', function (eventData) { clientSideValidations.callbacks.form.after( form, eventData); } )
|
28
|
+
.bind('form:validate:before', function (eventData) { clientSideValidations.callbacks.form.before(form, eventData); } )
|
29
|
+
.bind('form:validate:fail', function (eventData) { clientSideValidations.callbacks.form.fail( form, eventData); } )
|
30
|
+
.bind('form:validate:pass', function (eventData) { clientSideValidations.callbacks.form.pass( form, eventData); } )
|
25
31
|
|
26
32
|
// Set up the events for each validatable form element
|
27
33
|
.find('[data-validate]:input:not(:radio)')
|
28
|
-
.live('focusout', function() { $(this).isValid(settings.validators); })
|
29
|
-
.live('change', function() { $(this).data('changed', true); })
|
34
|
+
.live('focusout', function () { $(this).isValid(settings.validators); })
|
35
|
+
.live('change', function () { $(this).data('changed', true); })
|
30
36
|
// Callbacks
|
31
|
-
.live('element:validate:after', function(eventData) { clientSideValidations.callbacks.element.after( $(this), eventData); })
|
32
|
-
.live('element:validate:before', function(eventData) { clientSideValidations.callbacks.element.before($(this), eventData); })
|
33
|
-
.live('element:validate:fail', function(eventData, message) {
|
37
|
+
.live('element:validate:after', function (eventData) { clientSideValidations.callbacks.element.after( $(this), eventData); })
|
38
|
+
.live('element:validate:before', function (eventData) { clientSideValidations.callbacks.element.before($(this), eventData); })
|
39
|
+
.live('element:validate:fail', function (eventData, message) {
|
34
40
|
var element = $(this);
|
35
|
-
clientSideValidations.callbacks.element.fail(element, message, function() {
|
41
|
+
clientSideValidations.callbacks.element.fail(element, message, function () {
|
36
42
|
addError(element, message);
|
37
|
-
}, eventData) })
|
38
|
-
.live('element:validate:pass', function(eventData) {
|
43
|
+
}, eventData); })
|
44
|
+
.live('element:validate:pass', function (eventData) {
|
39
45
|
var element = $(this);
|
40
|
-
clientSideValidations.callbacks.element.pass(element, function() {
|
46
|
+
clientSideValidations.callbacks.element.pass(element, function () {
|
41
47
|
removeError(element);
|
42
|
-
}, eventData) })
|
48
|
+
}, eventData); })
|
43
49
|
// Checkboxes - Live events don't support filter
|
44
50
|
.end().find('[data-validate]:checkbox')
|
45
|
-
.live('click', function() { $(this).isValid(settings.validators); })
|
51
|
+
.live('click', function () { $(this).isValid(settings.validators); })
|
46
52
|
// Inputs for confirmations
|
47
|
-
.end().find('[id*=_confirmation]').each(function() {
|
53
|
+
.end().find('[id*=_confirmation]').each(function () {
|
48
54
|
var confirmationElement = $(this),
|
49
55
|
element = form.find('#' + this.id.match(/(.+)_confirmation/)[1] + '[data-validate]:input');
|
50
56
|
|
51
57
|
if (element[0]) {
|
52
58
|
$('#' + confirmationElement.attr('id'))
|
53
|
-
.live('focusout', function() {
|
59
|
+
.live('focusout', function () {
|
54
60
|
element.data('changed', true).isValid(settings.validators);
|
55
61
|
})
|
56
|
-
.live('keyup', function() {
|
62
|
+
.live('keyup', function () {
|
57
63
|
element.data('changed', true).isValid(settings.validators);
|
58
|
-
})
|
64
|
+
});
|
59
65
|
}
|
60
66
|
});
|
61
67
|
|
62
|
-
var addError = function(element, message) {
|
63
|
-
clientSideValidations.formBuilders[settings.type].add(element, settings, message);
|
64
|
-
}
|
65
|
-
|
66
|
-
var removeError = function(element) {
|
67
|
-
clientSideValidations.formBuilders[settings.type].remove(element, settings);
|
68
|
-
}
|
69
68
|
});
|
70
|
-
}
|
69
|
+
};
|
71
70
|
|
72
|
-
$.fn.isValid = function(validators) {
|
71
|
+
$.fn.isValid = function (validators) {
|
73
72
|
if ($(this[0]).is('form')) {
|
74
73
|
return validateForm($(this[0]), validators);
|
75
74
|
} else {
|
76
75
|
return validateElement($(this[0]), validators[this[0].name]);
|
77
76
|
}
|
78
|
-
}
|
77
|
+
};
|
79
78
|
|
80
|
-
var validateForm = function(form, validators) {
|
79
|
+
var validateForm = function (form, validators) {
|
81
80
|
var valid = true;
|
82
81
|
|
83
82
|
form.trigger('form:validate:before').find('[data-validate]:input').each(function() {
|
@@ -92,48 +91,47 @@
|
|
92
91
|
|
93
92
|
form.trigger('form:validate:after');
|
94
93
|
return valid;
|
95
|
-
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
94
|
+
},
|
95
|
+
validateElement = function (element, validators) {
|
96
|
+
element.trigger('element:validate:before');
|
97
|
+
|
98
|
+
if (element.data('changed') !== false) {
|
99
|
+
var valid = true;
|
100
|
+
element.data('changed', false);
|
101
|
+
|
102
|
+
// Because 'length' is defined on the list of validators we cannot call jQuery.each on
|
103
|
+
// the clientSideValidations.validators.all() object
|
104
|
+
for (kind in clientSideValidations.validators.all()) {
|
105
|
+
if (validators[kind] && (message = clientSideValidations.validators.all()[kind](element, validators[kind]))) {
|
106
|
+
element.trigger('element:validate:fail', message).data('valid', false);
|
107
|
+
valid = false;
|
108
|
+
break;
|
109
|
+
}
|
111
110
|
}
|
112
|
-
}
|
113
111
|
|
114
|
-
|
115
|
-
|
112
|
+
if (valid) { element.data('valid', null); element.trigger('element:validate:pass'); }
|
113
|
+
}
|
116
114
|
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
element.trigger('element:validate:after');
|
116
|
+
return element.data('valid') === false ? false : true;
|
117
|
+
};
|
120
118
|
|
121
119
|
// Main hook
|
122
120
|
// If new forms are dynamically introduced into the DOM the .validate() method
|
123
121
|
// must be invoked on that form
|
124
|
-
$(function() { $('form[data-validate]').validate(); })
|
122
|
+
$(function () { $('form[data-validate]').validate(); });
|
125
123
|
})(jQuery);
|
126
124
|
|
127
125
|
var clientSideValidations = {
|
128
126
|
validators: {
|
129
|
-
all: function() { return jQuery.extend({}, clientSideValidations.validators.local, clientSideValidations.validators.remote) },
|
127
|
+
all: function() { return jQuery.extend({}, clientSideValidations.validators.local, clientSideValidations.validators.remote); },
|
130
128
|
local: {
|
131
|
-
presence: function(element, options) {
|
129
|
+
presence: function (element, options) {
|
132
130
|
if (/^\s*$/.test(element.val() || "")) {
|
133
131
|
return options.message;
|
134
132
|
}
|
135
133
|
},
|
136
|
-
acceptance: function(element, options) {
|
134
|
+
acceptance: function (element, options) {
|
137
135
|
switch (element.attr('type')) {
|
138
136
|
case 'checkbox':
|
139
137
|
if (!element.attr('checked')) {
|
@@ -147,8 +145,8 @@ var clientSideValidations = {
|
|
147
145
|
break;
|
148
146
|
}
|
149
147
|
},
|
150
|
-
format: function(element, options) {
|
151
|
-
if ((message = this.presence(element, options)) && options.allow_blank
|
148
|
+
format: function (element, options) {
|
149
|
+
if ((message = this.presence(element, options)) && options.allow_blank === true) {
|
152
150
|
return;
|
153
151
|
} else if (message) {
|
154
152
|
return message;
|
@@ -160,7 +158,7 @@ var clientSideValidations = {
|
|
160
158
|
}
|
161
159
|
}
|
162
160
|
},
|
163
|
-
numericality: function(element, options) {
|
161
|
+
numericality: function (element, options) {
|
164
162
|
if (!/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d*)?$/.test(element.val())) {
|
165
163
|
return options.messages.numericality;
|
166
164
|
}
|
@@ -170,82 +168,83 @@ var clientSideValidations = {
|
|
170
168
|
}
|
171
169
|
|
172
170
|
var CHECKS = { greater_than: '>', greater_than_or_equal_to: '>=',
|
173
|
-
equal_to: '==', less_than: '<', less_than_or_equal_to: '<=' }
|
171
|
+
equal_to: '==', less_than: '<', less_than_or_equal_to: '<=' };
|
174
172
|
|
175
|
-
for (
|
176
|
-
if (options[check]
|
173
|
+
for (check in CHECKS) {
|
174
|
+
if (options[check] !== undefined && !(new Function("return " + element.val() + CHECKS[check] + options[check])())) {
|
177
175
|
return options.messages[check];
|
178
176
|
}
|
179
177
|
}
|
180
178
|
|
181
|
-
if (options.odd && !(parseInt(element.val()) % 2)) {
|
179
|
+
if (options.odd && !(parseInt(element.val(), 10) % 2)) {
|
182
180
|
return options.messages.odd;
|
183
181
|
}
|
184
182
|
|
185
|
-
if (options.even && (parseInt(element.val()) % 2)) {
|
183
|
+
if (options.even && (parseInt(element.val(), 10) % 2)) {
|
186
184
|
return options.messages.even;
|
187
185
|
}
|
188
186
|
},
|
189
|
-
length: function(element, options) {
|
190
|
-
var blankOptions = {}
|
187
|
+
length: function (element, options) {
|
188
|
+
var blankOptions = {},
|
189
|
+
CHECKS = { is: '==', minimum: '>=', maximum: '<=' },
|
190
|
+
tokenizer = options.js_tokenizer || "split('')",
|
191
|
+
tokenized_length = new Function("element", "return (element.val()." + tokenizer + " || '').length;")(element);
|
191
192
|
if (options.is) {
|
192
193
|
blankOptions.message = options.messages.is;
|
193
194
|
} else if (options.minimum) {
|
194
195
|
blankOptions.message = options.messages.minimum;
|
195
196
|
}
|
196
|
-
if ((message = this.presence(element, blankOptions)) && options.allow_blank
|
197
|
+
if ((message = this.presence(element, blankOptions)) && options.allow_blank === true) {
|
197
198
|
return;
|
198
199
|
} else if (message) {
|
199
200
|
return message;
|
200
201
|
} else {
|
201
|
-
|
202
|
-
var tokenizer = options.js_tokenizer || "split('')";
|
203
|
-
var tokenized_length = new Function("element", "return (element.val()." + tokenizer + " || '').length;")(element);
|
204
|
-
|
205
|
-
for (var check in CHECKS) {
|
202
|
+
for (check in CHECKS) {
|
206
203
|
if (options[check] && !(new Function("return " + tokenized_length + CHECKS[check] + options[check])())) {
|
207
204
|
return options.messages[check];
|
208
205
|
}
|
209
206
|
}
|
210
207
|
}
|
211
208
|
},
|
212
|
-
exclusion: function(element, options) {
|
213
|
-
|
209
|
+
exclusion: function (element, options) {
|
210
|
+
var lower = null, upper = null;
|
211
|
+
if ((message = this.presence(element, options)) && options.allow_blank === true) {
|
214
212
|
return;
|
215
213
|
} else if (message) {
|
216
214
|
return message;
|
217
215
|
} else {
|
218
216
|
if (options['in']) {
|
219
|
-
for (
|
217
|
+
for (i = 0; i < options['in'].length; i = i + 1) {
|
220
218
|
if (options['in'][i] == element.val()) {
|
221
219
|
return options.message;
|
222
220
|
}
|
223
221
|
}
|
224
|
-
} else if (options
|
225
|
-
|
226
|
-
|
222
|
+
} else if (options.range) {
|
223
|
+
lower = options.range[0];
|
224
|
+
upper = options.range[1];
|
227
225
|
if (element.val() >= lower && element.val() <= upper) {
|
228
226
|
return options.message;
|
229
227
|
}
|
230
228
|
}
|
231
229
|
}
|
232
230
|
},
|
233
|
-
inclusion: function(element, options) {
|
234
|
-
|
231
|
+
inclusion: function (element, options) {
|
232
|
+
var lower = null, upper = null;
|
233
|
+
if ((message = this.presence(element, options)) && options.allow_blank === true) {
|
235
234
|
return;
|
236
235
|
} else if (message) {
|
237
236
|
return message;
|
238
237
|
} else {
|
239
238
|
if (options['in']) {
|
240
|
-
for (
|
239
|
+
for (i = 0; i < options['in'].length; i = i + 1) {
|
241
240
|
if (options['in'][i] == element.val()) {
|
242
241
|
return;
|
243
242
|
}
|
244
243
|
}
|
245
244
|
return options.message;
|
246
|
-
} else if (options
|
247
|
-
|
248
|
-
|
245
|
+
} else if (options.range) {
|
246
|
+
lower = options.range[0];
|
247
|
+
upper = options.range[1];
|
249
248
|
|
250
249
|
if (element.val() >= lower && element.val() <= upper) {
|
251
250
|
return;
|
@@ -255,25 +254,26 @@ var clientSideValidations = {
|
|
255
254
|
}
|
256
255
|
}
|
257
256
|
},
|
258
|
-
confirmation: function(element, options) {
|
259
|
-
if (element.val()
|
257
|
+
confirmation: function (element, options) {
|
258
|
+
if (element.val() !== jQuery('#' + element.attr('id') + '_confirmation').val()) {
|
260
259
|
return options.message;
|
261
260
|
}
|
262
261
|
}
|
263
262
|
},
|
264
263
|
remote: {
|
265
|
-
uniqueness: function(element, options) {
|
266
|
-
var data = {}
|
267
|
-
|
264
|
+
uniqueness: function (element, options) {
|
265
|
+
var data = {},
|
266
|
+
name = null;
|
267
|
+
data.case_sensitive = !!options.case_sensitive;
|
268
268
|
if (options.id) {
|
269
|
-
data
|
269
|
+
data.id = options.id;
|
270
270
|
}
|
271
271
|
|
272
272
|
if (options.scope) {
|
273
|
-
data.scope = {}
|
273
|
+
data.scope = {};
|
274
274
|
for (key in options.scope) {
|
275
|
-
var scoped_element = jQuery('[name="' + element.attr('name').replace(/\[\w
|
276
|
-
if (scoped_element[0] && scoped_element.val()
|
275
|
+
var scoped_element = jQuery('[name="' + element.attr('name').replace(/\[\w+\]$/, '[' + key + ']' + '"]'));
|
276
|
+
if (scoped_element[0] && scoped_element.val() !== options.scope[key]) {
|
277
277
|
data.scope[key] = scoped_element.val();
|
278
278
|
scoped_element.unbind('change.' + element.id).bind('change.' + element.id, function() { element.trigger('change'); element.trigger('focusout'); });
|
279
279
|
} else {
|
@@ -286,16 +286,16 @@ var clientSideValidations = {
|
|
286
286
|
// e.g. user[records_attributes][0][title] => records[title]
|
287
287
|
// e.g. user[record_attributes][title] => record[title]
|
288
288
|
// Server side handles classifying the resource properly
|
289
|
-
if (/_attributes]/.test(element.attr('name'))) {
|
290
|
-
|
291
|
-
name += /(\[\w
|
289
|
+
if (/_attributes\]/.test(element.attr('name'))) {
|
290
|
+
name = element.attr('name').match(/\[\w+_attributes\]/g).pop().match(/\[(\w+)_attributes\]/).pop();
|
291
|
+
name += /(\[\w+\])$/.exec(element.attr('name'))[1];
|
292
292
|
} else {
|
293
|
-
|
293
|
+
name = element.attr('name');
|
294
294
|
}
|
295
295
|
|
296
296
|
// Override the name if a nested module class is passed
|
297
297
|
if (options['class']) {
|
298
|
-
name = options['class'] + '[' + name.split('[')[1]
|
298
|
+
name = options['class'] + '[' + name.split('[')[1];
|
299
299
|
}
|
300
300
|
data[name] = element.val();
|
301
301
|
|
@@ -303,7 +303,7 @@ var clientSideValidations = {
|
|
303
303
|
url: '/validators/uniqueness.json',
|
304
304
|
data: data,
|
305
305
|
async: false
|
306
|
-
}).status
|
306
|
+
}).status === 200) {
|
307
307
|
return options.message;
|
308
308
|
}
|
309
309
|
}
|
@@ -311,13 +311,13 @@ var clientSideValidations = {
|
|
311
311
|
},
|
312
312
|
formBuilders: {
|
313
313
|
'ActionView::Helpers::FormBuilder': {
|
314
|
-
add: function(element, settings, message) {
|
315
|
-
if (element.data('valid') !== false && jQuery('label.message[for="' + element.attr('id') + '"]')[0]
|
314
|
+
add: function (element, settings, message) {
|
315
|
+
if (element.data('valid') !== false && jQuery('label.message[for="' + element.attr('id') + '"]')[0] === undefined) {
|
316
316
|
var inputErrorField = jQuery(settings.input_tag),
|
317
317
|
labelErrorField = jQuery(settings.label_tag),
|
318
318
|
label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)');
|
319
319
|
|
320
|
-
if (element.attr('autofocus')) { element.attr('autofocus', false) }
|
320
|
+
if (element.attr('autofocus')) { element.attr('autofocus', false); }
|
321
321
|
element.before(inputErrorField);
|
322
322
|
inputErrorField.find('span#input_tag').replaceWith(element);
|
323
323
|
inputErrorField.find('label.message').attr('for', element.attr('id'));
|
@@ -327,7 +327,7 @@ var clientSideValidations = {
|
|
327
327
|
}
|
328
328
|
jQuery('label.message[for="' + element.attr('id') + '"]').text(message);
|
329
329
|
},
|
330
|
-
remove: function(element, settings) {
|
330
|
+
remove: function (element, settings) {
|
331
331
|
var errorFieldClass = jQuery(settings.input_tag).attr('class'),
|
332
332
|
inputErrorField = element.closest('.' + errorFieldClass),
|
333
333
|
label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)'),
|
@@ -342,63 +342,64 @@ var clientSideValidations = {
|
|
342
342
|
}
|
343
343
|
},
|
344
344
|
'SimpleForm::FormBuilder': {
|
345
|
-
add: function(element, settings, message) {
|
345
|
+
add: function (element, settings, message) {
|
346
346
|
if (element.data('valid') !== false) {
|
347
|
-
var wrapper = element.closest(settings.wrapper_tag)
|
347
|
+
var wrapper = element.closest(settings.wrapper_tag),
|
348
|
+
errorElement = $('<' + settings.error_tag + ' class="' + settings.error_class + '">' + message + '</' + settings.error_tag + '>');
|
348
349
|
wrapper.addClass(settings.wrapper_error_class);
|
349
|
-
var errorElement = $('<' + settings.error_tag + ' class="' + settings.error_class + '">' + message + '</' + settings.error_tag + '>');
|
350
350
|
wrapper.append(errorElement);
|
351
351
|
} else {
|
352
352
|
element.parent().find(settings.error_tag + '.' + settings.error_class).text(message);
|
353
353
|
}
|
354
354
|
},
|
355
|
-
remove: function(element, settings) {
|
356
|
-
var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_error_class)
|
355
|
+
remove: function (element, settings) {
|
356
|
+
var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_error_class),
|
357
|
+
errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class);
|
357
358
|
wrapper.removeClass(settings.wrapper_error_class);
|
358
|
-
var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class);
|
359
359
|
errorElement.remove();
|
360
360
|
}
|
361
361
|
|
362
362
|
},
|
363
363
|
'Formtastic::SemanticFormBuilder': {
|
364
|
-
add: function(element, settings, message) {
|
364
|
+
add: function (element, settings, message) {
|
365
365
|
if (element.data('valid') !== false) {
|
366
|
-
var wrapper = element.closest('li')
|
366
|
+
var wrapper = element.closest('li'),
|
367
|
+
errorElement = jQuery('<p class="' + settings.inline_error_class + '">' + message + '</p>');
|
367
368
|
wrapper.addClass('error');
|
368
|
-
var errorElement = $('<p class="' + settings.inline_error_class + '">' + message + '</p>');
|
369
369
|
wrapper.append(errorElement);
|
370
370
|
} else {
|
371
371
|
element.parent().find('p.' + settings.inline_error_class).text(message);
|
372
372
|
}
|
373
373
|
},
|
374
|
-
remove: function(element, settings) {
|
375
|
-
var wrapper = element.closest('li.error')
|
374
|
+
remove: function (element, settings) {
|
375
|
+
var wrapper = element.closest('li.error'),
|
376
|
+
errorElement = wrapper.find('p.' + settings.inline_error_class);
|
376
377
|
wrapper.removeClass('error');
|
377
|
-
var errorElement = wrapper.find('p.' + settings.inline_error_class);
|
378
378
|
errorElement.remove();
|
379
379
|
}
|
380
380
|
},
|
381
381
|
'NestedForm::Builder': {
|
382
|
-
add: function(element, settings, message) {
|
382
|
+
add: function (element, settings, message) {
|
383
383
|
clientSideValidations.formBuilders['ActionView::Helpers::FormBuilder'].add(element, settings, message);
|
384
384
|
},
|
385
|
-
remove: function(element, settings, message) {
|
385
|
+
remove: function (element, settings, message) {
|
386
386
|
clientSideValidations.formBuilders['ActionView::Helpers::FormBuilder'].remove(element, settings, message);
|
387
387
|
}
|
388
388
|
}
|
389
389
|
},
|
390
390
|
callbacks: {
|
391
391
|
element: {
|
392
|
-
after: function(element, eventData) { },
|
393
|
-
before: function(element, eventData) { },
|
394
|
-
fail: function(element, message, addError, eventData) { addError() },
|
395
|
-
pass: function(element, removeError, eventData) { removeError() }
|
392
|
+
after: function (element, eventData) { },
|
393
|
+
before: function (element, eventData) { },
|
394
|
+
fail: function (element, message, addError, eventData) { addError(); },
|
395
|
+
pass: function (element, removeError, eventData) { removeError(); }
|
396
396
|
},
|
397
397
|
form: {
|
398
|
-
after: function(form, eventData) { },
|
399
|
-
before: function(form, eventData) { },
|
400
|
-
fail: function(form, eventData) { },
|
401
|
-
pass: function(form, eventData) { }
|
398
|
+
after: function (form, eventData) { },
|
399
|
+
before: function (form, eventData) { },
|
400
|
+
fail: function (form, eventData) { },
|
401
|
+
pass: function (form, eventData) { }
|
402
402
|
}
|
403
403
|
}
|
404
|
-
}
|
404
|
+
};
|
405
|
+
|
metadata
CHANGED
@@ -1,171 +1,215 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: client_side_validations
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.13
|
4
5
|
prerelease:
|
5
|
-
version: 3.0.12
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Brian Cardarella
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rails
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
18
|
+
requirements:
|
22
19
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 3.0.0
|
25
22
|
type: :development
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sqlite3
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: sqlite3
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
31
33
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
36
38
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: bson_ext
|
40
39
|
prerelease: false
|
41
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bson_ext
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
42
49
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
47
54
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: mongoid
|
51
55
|
prerelease: false
|
52
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: mongoid
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
53
65
|
none: false
|
54
|
-
requirements:
|
66
|
+
requirements:
|
55
67
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
68
|
+
- !ruby/object:Gem::Version
|
57
69
|
version: 2.0.0
|
58
70
|
type: :development
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: mongo_mapper
|
62
71
|
prerelease: false
|
63
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.0.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: mongo_mapper
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
64
81
|
none: false
|
65
|
-
requirements:
|
82
|
+
requirements:
|
66
83
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
84
|
+
- !ruby/object:Gem::Version
|
68
85
|
version: 0.9.0
|
69
86
|
type: :development
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: mocha
|
73
87
|
prerelease: false
|
74
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
89
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.9.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: mocha
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
80
102
|
type: :development
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: simple_form
|
84
103
|
prerelease: false
|
85
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
105
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version:
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: simple_form
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.5.0
|
91
118
|
type: :development
|
92
|
-
version_requirements: *id007
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: formtastic
|
95
119
|
prerelease: false
|
96
|
-
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.5.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: formtastic
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
97
129
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version:
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.2.0
|
102
134
|
type: :development
|
103
|
-
version_requirements: *id008
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
name: sinatra
|
106
135
|
prerelease: false
|
107
|
-
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 1.2.0
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: sinatra
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
108
145
|
none: false
|
109
|
-
requirements:
|
146
|
+
requirements:
|
110
147
|
- - ~>
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version:
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.0'
|
113
150
|
type: :development
|
114
|
-
version_requirements: *id009
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: shotgun
|
117
151
|
prerelease: false
|
118
|
-
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '1.0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: shotgun
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
119
161
|
none: false
|
120
|
-
requirements:
|
121
|
-
- -
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version:
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
124
166
|
type: :development
|
125
|
-
version_requirements: *id010
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: thin
|
128
167
|
prerelease: false
|
129
|
-
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
130
169
|
none: false
|
131
|
-
requirements:
|
132
|
-
- -
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version:
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: thin
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
135
182
|
type: :development
|
136
|
-
version_requirements: *id011
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: json
|
139
183
|
prerelease: false
|
140
|
-
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
185
|
none: false
|
142
|
-
requirements:
|
143
|
-
- -
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version:
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: json
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
146
198
|
type: :development
|
147
|
-
version_requirements: *id012
|
148
|
-
- !ruby/object:Gem::Dependency
|
149
|
-
name: ruby-debug19
|
150
199
|
prerelease: false
|
151
|
-
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
152
201
|
none: false
|
153
|
-
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version:
|
157
|
-
type: :development
|
158
|
-
version_requirements: *id013
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
159
206
|
description: Client Side Validations
|
160
|
-
email:
|
207
|
+
email:
|
161
208
|
- bcardarella@gmail.com
|
162
209
|
executables: []
|
163
|
-
|
164
210
|
extensions: []
|
165
|
-
|
166
211
|
extra_rdoc_files: []
|
167
|
-
|
168
|
-
files:
|
212
|
+
files:
|
169
213
|
- client_side_validations.gemspec
|
170
214
|
- lib/client_side_validations.rb
|
171
215
|
- lib/client_side_validations/action_view.rb
|
@@ -277,35 +321,37 @@ files:
|
|
277
321
|
- test/simple_form/cases/helper.rb
|
278
322
|
- test/simple_form/cases/test_form_builder.rb
|
279
323
|
- test/simple_form/cases/test_form_helper.rb
|
280
|
-
has_rdoc: true
|
281
324
|
homepage: https://github.com/bcardarella/client_side_validations
|
282
325
|
licenses: []
|
283
|
-
|
284
326
|
post_install_message:
|
285
327
|
rdoc_options: []
|
286
|
-
|
287
|
-
require_paths:
|
328
|
+
require_paths:
|
288
329
|
- lib
|
289
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
330
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
290
331
|
none: false
|
291
|
-
requirements:
|
292
|
-
- -
|
293
|
-
- !ruby/object:Gem::Version
|
294
|
-
version:
|
295
|
-
|
332
|
+
requirements:
|
333
|
+
- - ! '>='
|
334
|
+
- !ruby/object:Gem::Version
|
335
|
+
version: '0'
|
336
|
+
segments:
|
337
|
+
- 0
|
338
|
+
hash: 1590299980694445321
|
339
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
296
340
|
none: false
|
297
|
-
requirements:
|
298
|
-
- -
|
299
|
-
- !ruby/object:Gem::Version
|
300
|
-
version:
|
341
|
+
requirements:
|
342
|
+
- - ! '>='
|
343
|
+
- !ruby/object:Gem::Version
|
344
|
+
version: '0'
|
345
|
+
segments:
|
346
|
+
- 0
|
347
|
+
hash: 1590299980694445321
|
301
348
|
requirements: []
|
302
|
-
|
303
349
|
rubyforge_project:
|
304
|
-
rubygems_version: 1.
|
350
|
+
rubygems_version: 1.8.23
|
305
351
|
signing_key:
|
306
352
|
specification_version: 3
|
307
353
|
summary: Client Side Validations
|
308
|
-
test_files:
|
354
|
+
test_files:
|
309
355
|
- test/action_view/cases/helper.rb
|
310
356
|
- test/action_view/cases/test_helpers.rb
|
311
357
|
- test/action_view/cases/test_legacy_helpers.rb
|