client_side_validations-simple_form 2.0.0.beta.1 → 2.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -13,11 +13,12 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.require_paths = ['lib']
|
14
14
|
gem.version = ClientSideValidations::SimpleForm::VERSION
|
15
15
|
|
16
|
-
gem.add_dependency 'client_side_validations', '~> 3.2.0.beta.
|
16
|
+
gem.add_dependency 'client_side_validations', '~> 3.2.0.beta.6'
|
17
17
|
gem.add_dependency 'simple_form', '~> 2.0.0'
|
18
18
|
|
19
19
|
gem.add_development_dependency 'rails', '~> 3.2.0'
|
20
20
|
gem.add_development_dependency 'mocha'
|
21
|
+
gem.add_development_dependency 'm'
|
21
22
|
|
22
23
|
# For QUnit testing
|
23
24
|
gem.add_development_dependency 'sinatra', '~> 1.0'
|
@@ -10,7 +10,8 @@ module ClientSideValidations
|
|
10
10
|
:error_class => wrapper.find(:error).defaults[:class].first,
|
11
11
|
:error_tag => wrapper.find(:error).defaults[:tag],
|
12
12
|
:wrapper_error_class => wrapper.defaults[:error_class],
|
13
|
-
:wrapper_tag => wrapper.defaults[:tag]
|
13
|
+
:wrapper_tag => wrapper.defaults[:tag],
|
14
|
+
:wrapper => options[:wrapper] || ::SimpleForm.default_wrapper
|
14
15
|
}
|
15
16
|
end
|
16
17
|
alias_method_chain :input, :client_side_validations
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
Client Side Validations - SimpleForm - v2.0.0.beta.
|
3
|
+
Client Side Validations - SimpleForm - v2.0.0.beta.2
|
4
4
|
https://github.com/dockyard/client_side_validations-simple_form
|
5
5
|
|
6
6
|
Copyright (c) 2012 DockYard, LLC
|
@@ -13,25 +13,43 @@
|
|
13
13
|
|
14
14
|
ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = {
|
15
15
|
add: function(element, settings, message) {
|
16
|
-
|
17
|
-
if (element.data('valid') !== false) {
|
18
|
-
wrapper = element.closest(settings.wrapper_tag);
|
19
|
-
wrapper.addClass(settings.wrapper_error_class);
|
20
|
-
errorElement = $("<" + settings.error_tag + "/>", {
|
21
|
-
"class": settings.error_class,
|
22
|
-
text: message
|
23
|
-
});
|
24
|
-
return wrapper.append(errorElement);
|
25
|
-
} else {
|
26
|
-
return element.parent().find("" + settings.error_tag + "." + settings.error_class).text(message);
|
27
|
-
}
|
16
|
+
return this.wrappers[settings.wrapper].add.call(this, element, settings, message);
|
28
17
|
},
|
29
18
|
remove: function(element, settings) {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
19
|
+
return this.wrappers[settings.wrapper].remove.call(this, element, settings);
|
20
|
+
},
|
21
|
+
wrappers: {
|
22
|
+
"default": {
|
23
|
+
add: function(element, settings, message) {
|
24
|
+
var errorElement, wrapper;
|
25
|
+
if (element.data('valid') !== false) {
|
26
|
+
wrapper = element.closest(settings.wrapper_tag);
|
27
|
+
wrapper.addClass(settings.wrapper_error_class);
|
28
|
+
errorElement = $("<" + settings.error_tag + "/>", {
|
29
|
+
"class": settings.error_class,
|
30
|
+
text: message
|
31
|
+
});
|
32
|
+
return wrapper.append(errorElement);
|
33
|
+
} else {
|
34
|
+
return element.parent().find("" + settings.error_tag + "." + settings.error_class).text(message);
|
35
|
+
}
|
36
|
+
},
|
37
|
+
remove: function(element, settings) {
|
38
|
+
var errorElement, wrapper;
|
39
|
+
wrapper = element.closest("" + settings.wrapper_tag + "." + settings.wrapper_error_class);
|
40
|
+
wrapper.removeClass(settings.wrapper_error_class);
|
41
|
+
errorElement = wrapper.find("" + settings.error_tag + "." + settings.error_class);
|
42
|
+
return errorElement.remove();
|
43
|
+
}
|
44
|
+
},
|
45
|
+
bootstrap: {
|
46
|
+
add: function(element, settings, message) {
|
47
|
+
return this.wrappers['default'].add.call(this, element, settings, message);
|
48
|
+
},
|
49
|
+
remove: function(element, settings) {
|
50
|
+
return this.wrappers['default'].remove.call(this, element, settings);
|
51
|
+
}
|
52
|
+
}
|
35
53
|
}
|
36
54
|
};
|
37
55
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: client_side_validations-simple_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: client_side_validations
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.0.beta.
|
21
|
+
version: 3.2.0.beta.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.0.beta.
|
29
|
+
version: 3.2.0.beta.6
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: simple_form
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: m
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
95
|
name: sinatra
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,6 +198,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
198
|
- - ! '>='
|
183
199
|
- !ruby/object:Gem::Version
|
184
200
|
version: '0'
|
201
|
+
segments:
|
202
|
+
- 0
|
203
|
+
hash: 3509802106206231315
|
185
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
205
|
none: false
|
187
206
|
requirements:
|