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.
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- enlightenment (0.0.1.pre.3)
12
+ enlightenment (0.0.1.pre.4)
13
13
  green_light
14
14
  i18n-js
15
15
  jquery-rails
@@ -1,4 +1,11 @@
1
1
  module Enlightenment
2
2
  module ApplicationHelper
3
+ def method_missing(method, *args, &block)
4
+ enlightenment.send(method, *args, &block)
5
+ rescue NoMethodError
6
+ main_app.send(method, *args, &block)
7
+ rescue NoMethodError
8
+ super
9
+ end
3
10
  end
4
11
  end
@@ -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
 
@@ -5,6 +5,7 @@ module Enlightenment
5
5
  include Validations::CallbackValidator
6
6
  include Validations::CleanupValidator
7
7
  include Validations::ValidatesAssociated
8
+ include Validations::ValidatesFormat
8
9
  include Validations::ValidatesUniqueness
9
10
 
10
11
  class << self
@@ -0,0 +1,13 @@
1
+ module Enlightenment
2
+ module Validations
3
+ module ValidatesFormat
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+ def format_validator(params = {})
8
+ { :regex => params[:val_obj].options[:with].inspect }
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Enlightenment
2
- VERSION = "0.0.1.pre.3"
2
+ VERSION = "0.0.1.pre.4"
3
3
  end
@@ -16,7 +16,26 @@
16
16
  highlight : undefined,
17
17
  unhighlight : undefined
18
18
  },
19
- // messages
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 = new RegExp(regexp.replace('\\A', '^').replace('\\z', '$'));
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.3
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-15 00:00:00.000000000 Z
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: -425918526441680426
288
+ hash: -1456249121780748167
288
289
  required_rubygems_version: !ruby/object:Gem::Requirement
289
290
  none: false
290
291
  requirements: