enlightenment 0.0.1.pre.3 → 0.0.1.pre.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/app/helpers/enlightenment/application_helper.rb +7 -0
- data/lib/enlightenment.rb +1 -0
- data/lib/enlightenment/rules.rb +1 -0
- data/lib/enlightenment/validations/validates_format.rb +13 -0
- data/lib/enlightenment/version.rb +1 -1
- data/vendor/assets/javascripts/enlightenment.js +27 -32
- metadata +4 -3
data/Gemfile.lock
CHANGED
data/lib/enlightenment.rb
CHANGED
@@ -45,6 +45,7 @@ module Enlightenment
|
|
45
45
|
autoload :CallbackValidator, 'enlightenment/validations/callback_validator'
|
46
46
|
autoload :CleanupValidator, 'enlightenment/validations/cleanup_validator'
|
47
47
|
autoload :ValidatesAssociated, 'enlightenment/validations/validates_associated'
|
48
|
+
autoload :ValidatesFormat, 'enlightenment/validations/validates_format'
|
48
49
|
autoload :ValidatesUniqueness, 'enlightenment/validations/validates_uniqueness'
|
49
50
|
end
|
50
51
|
|
data/lib/enlightenment/rules.rb
CHANGED
@@ -16,7 +16,26 @@
|
|
16
16
|
highlight : undefined,
|
17
17
|
unhighlight : undefined
|
18
18
|
},
|
19
|
-
|
19
|
+
|
20
|
+
messages : {
|
21
|
+
// remote : message('invalid'),
|
22
|
+
required : message('blank'),
|
23
|
+
regex : message('invalid'),
|
24
|
+
email : message('invalid'),
|
25
|
+
url : message('invalid'),
|
26
|
+
date : message('invalid'),
|
27
|
+
dateISO : message('invalid'),
|
28
|
+
number : message('invalid'),
|
29
|
+
digits : message('invalid'),
|
30
|
+
creditcard : message('invalid'),
|
31
|
+
equalTo : message('invalid'),
|
32
|
+
maxlength : message('invalid'),
|
33
|
+
minlength : message('invalid'),
|
34
|
+
rangelength : message('invalid'),
|
35
|
+
range : message('invalid'),
|
36
|
+
max : message('invalid'),
|
37
|
+
min : message('invalid')
|
38
|
+
},
|
20
39
|
|
21
40
|
prototype : {
|
22
41
|
addWrapper : function addWrapper(target) {
|
@@ -35,8 +54,13 @@
|
|
35
54
|
|
36
55
|
$.extend(this.validator.settings, validator.settings || {});
|
37
56
|
$.extend(this.validator.prototype, validator.prototype || {});
|
57
|
+
$.extend(this.validator.messages, validator.messages || {});
|
38
58
|
};
|
39
59
|
|
60
|
+
$(function() {
|
61
|
+
$.extend($.validator.prototype, $.enlightenment.validator.prototype);
|
62
|
+
$.extend($.validator.messages, $.enlightenment.validator.messages);
|
63
|
+
});
|
40
64
|
|
41
65
|
// extensions to jquery
|
42
66
|
// --------------------------------------------------------------------------
|
@@ -85,10 +109,9 @@
|
|
85
109
|
// --------------------------------------------------------------------------
|
86
110
|
$.validator.addMethod('regex', function(value, element, regexp) {
|
87
111
|
var check = false;
|
88
|
-
var re =
|
112
|
+
var re = eval(regexp);
|
89
113
|
return this.optional(element) || re.test(value);
|
90
|
-
}
|
91
|
-
'You have entered an invalid value for this field'
|
114
|
+
}
|
92
115
|
);
|
93
116
|
|
94
117
|
$.validator.addMethod('remote', function(value, element, url) {
|
@@ -172,34 +195,6 @@
|
|
172
195
|
return "pending";
|
173
196
|
});
|
174
197
|
|
175
|
-
$(function() {
|
176
|
-
$.extend($.validator.prototype, $.enlightenment.validator.prototype);
|
177
|
-
});
|
178
|
-
|
179
|
-
// TODO: make non-specific to bootstrap & app-custom label
|
180
|
-
// $.validator.prototype.errorsFor = function(element) {
|
181
|
-
// return $(element).closest('div.controls').find('label.error');
|
182
|
-
// };
|
183
|
-
|
184
|
-
$.validator.messages = {
|
185
|
-
// remote : message('invalid'),
|
186
|
-
required : message('invalid'),
|
187
|
-
email : message('invalid'),
|
188
|
-
url : message('invalid'),
|
189
|
-
date : message('invalid'),
|
190
|
-
dateISO : message('invalid'),
|
191
|
-
number : message('invalid'),
|
192
|
-
digits : message('invalid'),
|
193
|
-
creditcard : message('invalid'),
|
194
|
-
equalTo : message('invalid'),
|
195
|
-
maxlength : message('invalid'),
|
196
|
-
minlength : message('invalid'),
|
197
|
-
rangelength : message('invalid'),
|
198
|
-
range : message('invalid'),
|
199
|
-
max : message('invalid'),
|
200
|
-
min : message('invalid')
|
201
|
-
};
|
202
|
-
|
203
198
|
var pending = {};
|
204
199
|
|
205
200
|
function message(key) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enlightenment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.pre.
|
4
|
+
version: 0.0.1.pre.4
|
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-10-
|
12
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/enlightenment/validations/callback_validator.rb
|
223
223
|
- lib/enlightenment/validations/cleanup_validator.rb
|
224
224
|
- lib/enlightenment/validations/validates_associated.rb
|
225
|
+
- lib/enlightenment/validations/validates_format.rb
|
225
226
|
- lib/enlightenment/validations/validates_uniqueness.rb
|
226
227
|
- lib/enlightenment/version.rb
|
227
228
|
- lib/tasks/enlightenment_tasks.rake
|
@@ -284,7 +285,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
284
285
|
version: '0'
|
285
286
|
segments:
|
286
287
|
- 0
|
287
|
-
hash: -
|
288
|
+
hash: -1456249121780748167
|
288
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
289
290
|
none: false
|
290
291
|
requirements:
|