client_side_validations 3.2.0.beta.2 → 3.2.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -75,11 +75,23 @@ module ClientSideValidations::ActionView::Helpers
75
75
  if options[:html] && options[:html][:id]
76
76
  var_name = options[:html][:id]
77
77
  else
78
- var_name = if object.respond_to?(:persisted?) && object.persisted?
79
- options[:as] ? "#{options[:as]}_edit" : dom_id(object, :edit)
78
+ if Rails.version >= '3.2.0'
79
+ var_name = if object.respond_to?(:persisted?) && object.persisted?
80
+ options[:as] ? "edit_#{options[:as]}" : [options[:namespace], dom_id(object, :edit)].compact.join("_")
81
+ else
82
+ options[:as] ? "new_#{options[:as]}" : [options[:namespace], dom_id(object)].compact.join("_")
83
+ end
80
84
  else
81
- options[:as] ? "#{options[:as]}_new" : dom_id(object)
85
+ # This is to maintain backward compatibility with Rails 3.1
86
+ # see: https://github.com/rails/rails/commit/e29773f885fd500189ffd964550ae20061d745ba#commitcomment-948052
87
+ var_name = if object.respond_to?(:persisted?) && object.persisted?
88
+ options[:as] ? "#{options[:as]}_edit" : dom_id(object, :edit)
89
+ else
90
+ options[:as] ? "#{options[:as]}_new" : dom_id(object)
91
+ end
82
92
  end
93
+
94
+
83
95
  end
84
96
 
85
97
  content_tag(:script) do
@@ -9,7 +9,7 @@ module ClientSideValidations::ActiveModel
9
9
 
10
10
  self.class::MESSAGES.each do |option, message_type|
11
11
  if count = options[option]
12
- options[:message] = options[message_type]
12
+ options[:message] = options[message_type] if options[message_type].present?
13
13
  options.delete(:message) if options[:message].nil?
14
14
  hash[:messages][option] = model.errors.generate_message(attribute, message_type, options.merge(:count => count))
15
15
  hash[option] = count
@@ -1,3 +1,3 @@
1
1
  module ClientSideValidations
2
- VERSION = '3.2.0.beta.2'
2
+ VERSION = '3.2.0.beta.3'
3
3
  end
@@ -1,117 +1,149 @@
1
-
2
- /*
3
- Rails 3 Client Side Validations - v3.2.0.beta.2
4
- https://github.com/bcardarella/client_side_validations
5
-
6
- Copyright (c) 2012 Brian Cardarella
7
- Licensed under the MIT license
8
- http://www.opensource.org/licenses/mit-license.php
9
- */
10
-
11
1
  (function() {
12
- var $, validateElement, validateForm;
2
+ var $, validateElement, validateForm,
3
+ __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
13
4
 
14
5
  $ = jQuery;
15
6
 
16
7
  $.fn.validate = function() {
17
8
  return this.filter('form[data-validate]').each(function() {
18
- var addError, form, removeError, settings;
9
+ var addError, binding, event, form, removeError, settings, _ref, _ref2;
19
10
  form = $(this);
20
- settings = window['ClientSideValidations']['forms'][form.attr('id')];
11
+ settings = window.ClientSideValidations.forms[form.attr('id')];
21
12
  addError = function(element, message) {
22
13
  return ClientSideValidations.formBuilders[settings.type].add(element, settings, message);
23
14
  };
24
15
  removeError = function(element) {
25
16
  return ClientSideValidations.formBuilders[settings.type].remove(element, settings);
26
17
  };
27
- return form.submit(function() {
18
+ form.submit(function() {
28
19
  return form.isValid(settings.validators);
29
- }).bind('ajax:beforeSend', function(eventData) {
30
- if (eventData.target === this) return form.isValid(settings.validators);
31
- }).bind('form:validate:after', function(eventData) {
32
- return ClientSideValidations.callbacks.form.after(form, eventData);
33
- }).bind('form:validate:before', function(eventData) {
34
- return ClientSideValidations.callbacks.form.before(form, eventData);
35
- }).bind('form:validate:fail', function(eventData) {
36
- return ClientSideValidations.callbacks.form.fail(form, eventData);
37
- }).bind('form:validate:pass', function(eventData) {
38
- return ClientSideValidations.callbacks.form.pass(form, eventData);
39
- }).find('[data-validate="true"]:input:enabled:not(:radio)').live('focusout', function() {
40
- return $(this).isValid(settings.validators);
41
- }).live('change', function() {
42
- return $(this).data('changed', true);
43
- }).live('element:validate:after', function(eventData) {
44
- return ClientSideValidations.callbacks.element.after($(this), eventData);
45
- }).live('element:validate:before', function(eventData) {
46
- return ClientSideValidations.callbacks.element.before($(this), eventData);
47
- }).live('element:validate:fail', function(eventData, message) {
48
- var element;
49
- element = $(this);
50
- return ClientSideValidations.callbacks.element.fail(element, message, function() {
51
- return addError(element, message);
52
- }, eventData);
53
- }).live('element:validate:pass', function(eventData, message) {
54
- var element;
55
- element = $(this);
56
- return ClientSideValidations.callbacks.element.pass(element, function() {
57
- return removeError(element);
58
- }, eventData);
59
- }).end().find('[data-validate="true"]:checkbox').live('click', function() {
20
+ });
21
+ _ref = {
22
+ 'ajax:beforeSend': function(eventData) {
23
+ if (eventData.target === this) return form.isValid(settings.validators);
24
+ },
25
+ 'form:validate:after': function(eventData) {
26
+ return ClientSideValidations.callbacks.form.after(form, eventData);
27
+ },
28
+ 'form:validate:before': function(eventData) {
29
+ return ClientSideValidations.callbacks.form.before(form, eventData);
30
+ },
31
+ 'form:validate:fail': function(eventData) {
32
+ return ClientSideValidations.callbacks.form.fail(form, eventData);
33
+ },
34
+ 'form:validate:pass': function(eventData) {
35
+ return ClientSideValidations.callbacks.form.pass(form, eventData);
36
+ }
37
+ };
38
+ for (event in _ref) {
39
+ binding = _ref[event];
40
+ form.bind(event, binding);
41
+ }
42
+ _ref2 = {
43
+ 'focusout': function() {
44
+ return $(this).isValid(settings.validators);
45
+ },
46
+ 'change': function() {
47
+ return $(this).data('changed', true);
48
+ },
49
+ 'element:validate:after': function(eventData) {
50
+ return ClientSideValidations.callbacks.element.after($(this), eventData);
51
+ },
52
+ 'element:validate:before': function(eventData) {
53
+ return ClientSideValidations.callbacks.element.before($(this), eventData);
54
+ },
55
+ 'element:validate:fail': function(eventData, message) {
56
+ var element;
57
+ element = $(this);
58
+ return ClientSideValidations.callbacks.element.fail(element, message, function() {
59
+ return addError(element, message);
60
+ }, eventData);
61
+ },
62
+ 'element:validate:pass': function(eventData) {
63
+ var element;
64
+ element = $(this);
65
+ return ClientSideValidations.callbacks.element.pass(element, function() {
66
+ return removeError(element);
67
+ }, eventData);
68
+ }
69
+ };
70
+ for (event in _ref2) {
71
+ binding = _ref2[event];
72
+ form.find('[data-validate="true"]:input:enabled:not(:radio)').live(event, binding);
73
+ }
74
+ form.find('[data-validate="true"]:checkbox').live('click', function() {
60
75
  return $(this).isValid(settings.validators);
61
- }).end().find('[id*=_confirmation]').each(function() {
62
- var confirmationElement, element;
76
+ });
77
+ return form.find('[id*=_confirmation]').each(function() {
78
+ var binding, confirmationElement, element, event, _ref3, _results;
63
79
  confirmationElement = $(this);
64
80
  element = form.find("#" + (this.id.match(/(.+)_confirmation/)[1]) + "[data-validate='true']:input");
65
81
  if (element[0]) {
66
- return $("#" + (confirmationElement.attr('id'))).live('focusout', function() {
67
- return element.data('changed', true).isValid(settings.validators);
68
- }).live('keyup', function() {
69
- return element.data('changed', true).isValid(settings.validators);
70
- });
82
+ _ref3 = {
83
+ 'focusout': function() {
84
+ return element.data('changed', true).isValid(settings.validators);
85
+ },
86
+ 'keyup': function() {
87
+ return element.data('changed', true).isValid(settings.validators);
88
+ }
89
+ };
90
+ _results = [];
91
+ for (event in _ref3) {
92
+ binding = _ref3[event];
93
+ _results.push($("#" + (confirmationElement.attr('id'))).live(event, binding));
94
+ }
95
+ return _results;
71
96
  }
72
97
  });
73
98
  });
74
99
  };
75
100
 
76
101
  $.fn.isValid = function(validators) {
77
- if ($(this[0]).is('form')) {
78
- return validateForm($(this[0]), validators);
102
+ var obj;
103
+ obj = $(this[0]);
104
+ if (obj.is('form')) {
105
+ return validateForm(obj, validators);
79
106
  } else {
80
- return validateElement($(this[0]), validators[this[0].name]);
107
+ return validateElement(obj, validators[this[0].name]);
81
108
  }
82
109
  };
83
110
 
84
111
  validateForm = function(form, validators) {
85
112
  var valid;
113
+ form.trigger('form:validate:before');
86
114
  valid = true;
87
- form.trigger('form:validate:before').find('[data-validate="true"]:input:enabled').each(function() {
88
- if (!$(this).isValid(validators)) valid = false;
89
- if (valid) {
90
- form.trigger('form:validate:pass');
91
- } else {
92
- form.trigger('form:validate:fail');
93
- }
94
- return form.trigger('form:validate:after');
115
+ form.find('[data-validate="true"]:input:enabled').each(function() {
116
+ if ($(this).isValid(validators)) return valid = false;
95
117
  });
118
+ if (valid) {
119
+ form.trigger('form:validate:pass');
120
+ } else {
121
+ form.trigger('form:validate:fail');
122
+ }
123
+ form.trigger('form:validate:after');
96
124
  return valid;
97
125
  };
98
126
 
99
127
  validateElement = function(element, validators) {
100
- var kind, message, valid;
128
+ var context, fn, kind, message, valid, _ref;
101
129
  element.trigger('element:validate:before');
102
130
  if (element.data('changed') !== false) {
103
131
  valid = true;
104
132
  element.data('changed', false);
105
- for (kind in ClientSideValidations.validators.local) {
106
- if (validators[kind] && (message = ClientSideValidations.validators.all()[kind](element, validators[kind]))) {
133
+ context = ClientSideValidations.validators.local;
134
+ for (kind in context) {
135
+ fn = context[kind];
136
+ if (validators[kind] && (message = fn.call(context, element, validators[kind]))) {
107
137
  element.trigger('element:validate:fail', message).data('valid', false);
108
138
  valid = false;
109
139
  break;
110
140
  }
111
141
  }
112
142
  if (valid) {
113
- for (kind in ClientSideValidations.validators.remote) {
114
- if (validators[kind] && (message = ClientSideValidations.validators.all()[kind](element, validators[kind]))) {
143
+ context = ClientSideValidations.validators.remote;
144
+ for (kind in context) {
145
+ fn = context[kind];
146
+ if (validators[kind] && (message = fn.call(context, element, validators[kind]))) {
115
147
  element.trigger('element:validate:fail', message).data('valid', false);
116
148
  valid = false;
117
149
  break;
@@ -122,13 +154,11 @@
122
154
  element.data('valid', null);
123
155
  element.trigger('element:validate:pass');
124
156
  }
125
- element.trigger('element:validate:after');
126
- if (element.data('valid') === false) {
127
- return false;
128
- } else {
129
- return true;
130
- }
131
157
  }
158
+ element.trigger('element:validate:after');
159
+ return (_ref = element.data('valid') === false) != null ? _ref : {
160
+ "false": true
161
+ };
132
162
  };
133
163
 
134
164
  $(function() {
@@ -139,35 +169,40 @@
139
169
  forms: {},
140
170
  validators: {
141
171
  all: function() {
142
- return $.extend({}, ClientSideValidations.validators.local, ClientSideValidations.validators.remote);
172
+ return jQuery.extend({}, ClientSideValidations.validators.local, ClientSideValidations.validators.remote);
143
173
  },
144
174
  local: {
145
175
  presence: function(element, options) {
146
- if (/^\s*$/.test(element.val() || "")) return options.message;
176
+ if (/^\s*$/.test(element.val() || '')) return options.message;
147
177
  },
148
178
  acceptance: function(element, options) {
179
+ var _ref;
149
180
  switch (element.attr('type')) {
150
181
  case 'checkbox':
151
182
  if (!element.attr('checked')) return options.message;
152
183
  break;
153
184
  case 'text':
154
- if (element.val() !== (options.accept || '1').toString()) {
185
+ if (element.val() !== (((_ref = options.accept) != null ? _ref.toString() : void 0) || '1')) {
155
186
  return options.message;
156
187
  }
157
188
  }
158
189
  },
159
190
  format: function(element, options) {
160
191
  var message;
161
- if ((message = this.presence(element, options)) && options.allow_blank === true) {} else if (message) {
192
+ message = this.presence(element, options);
193
+ if (message) {
194
+ if (options.allow_blank === true) return;
162
195
  return message;
163
- } else {
164
- if (options['with'] && !options['with'].test(element.val())) {
165
- return options.message;
166
- }
196
+ }
197
+ if (options["with"] && !options["with"].test(element.val())) {
198
+ return options.message;
199
+ }
200
+ if (options.without && options.without.test(element.val())) {
201
+ return options.message;
167
202
  }
168
203
  },
169
204
  numericality: function(element, options) {
170
- var CHECKS, check;
205
+ var CHECKS, check, fn, operator;
171
206
  if (!/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d*)?$/.test(element.val())) {
172
207
  return options.messages.numericality;
173
208
  }
@@ -182,9 +217,10 @@
182
217
  less_than_or_equal_to: '<='
183
218
  };
184
219
  for (check in CHECKS) {
185
- if (options[check] !== void 0 && !(new Function("return " + element.val() + CHECKS[check] + options[check])())) {
186
- return options.messages[check];
187
- }
220
+ operator = CHECKS[check];
221
+ if (!(options[check] != null)) continue;
222
+ fn = new Function("return " + (element.val()) + " " + operator + " " + options[check]);
223
+ if (!fn()) return options.messages[check];
188
224
  }
189
225
  if (options.odd && !(parseInt(element.val(), 10) % 2)) {
190
226
  return options.messages.odd;
@@ -194,119 +230,135 @@
194
230
  }
195
231
  },
196
232
  length: function(element, options) {
197
- var CHECKS, blankOptions, check, message, tokenized_length, tokenizer;
198
- blankOptions = {};
233
+ var CHECKS, blankOptions, check, fn, message, operator, tokenized_length, tokenizer;
234
+ tokenizer = options.js_tokenizer || "split('')";
235
+ tokenized_length = new Function('element', "return (element.val()." + tokenizer + " || '').length")(element);
199
236
  CHECKS = {
200
237
  is: '==',
201
238
  minimum: '>=',
202
239
  maximum: '<='
203
240
  };
204
- tokenizer = options.js_tokenizer || "split('')";
205
- tokenized_length = new Function("element", "return (element.val()." + tokenizer + " || '').length;")(element);
206
- if (options.is) {
207
- blankOptions.message = options.messages.is;
208
- } else if (options.minimum) {
209
- blankOptions.message = options.messages.minimum;
210
- }
211
- if ((message = this.presence(element, blankOptions)) && options.allow_blank === true) {} else if (message) {
241
+ blankOptions = {};
242
+ blankOptions.message = options.is ? options.messages.is : options.minimum ? options.messages.minimum : void 0;
243
+ message = this.presence(element, blankOptions);
244
+ if (message) {
245
+ if (options.allow_blank === true) return;
212
246
  return message;
213
- } else {
214
- for (check in CHECKS) {
215
- if (options[check] && !(new Function("return " + tokenized_length + CHECKS[check] + options[check])())) {
216
- return options.messages[check];
217
- }
218
- }
247
+ }
248
+ for (check in CHECKS) {
249
+ operator = CHECKS[check];
250
+ if (!options[check]) continue;
251
+ fn = new Function("return " + tokenized_length + " " + operator + " " + options[check]);
252
+ if (!fn()) return options.messages[check];
219
253
  }
220
254
  },
221
255
  exclusion: function(element, options) {
222
- var lower, message, upper, value;
223
- lower = null;
224
- upper = null;
225
- if ((message = this.presence(element, options)) && options.allow_blank === true) {} else if (message) {
256
+ var lower, message, o, upper, _ref;
257
+ message = this.presence(element, options);
258
+ if (message) {
259
+ if (options.allow_blank === true) return;
226
260
  return message;
227
- } else {
228
- if (options['in']) {
229
- for (value in options['in']) {
230
- if (value.toString() === element.val()) return options.message;
231
- }
232
- } else if (options.range) {
233
- lower = options.range[0];
234
- upper = options.range[1];
235
- if (element.val() >= lower && element.val() <= upper) {
236
- return options.message;
261
+ }
262
+ if (options["in"]) {
263
+ if (_ref = element.val(), __indexOf.call((function() {
264
+ var _i, _len, _ref2, _results;
265
+ _ref2 = options["in"];
266
+ _results = [];
267
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
268
+ o = _ref2[_i];
269
+ _results.push(o.toString());
237
270
  }
271
+ return _results;
272
+ })(), _ref) >= 0) {
273
+ return options.message;
274
+ }
275
+ }
276
+ if (options.range) {
277
+ lower = options.range[0];
278
+ upper = options.range[1];
279
+ if (element.val() >= lower && element.val() <= upper) {
280
+ return options.message;
238
281
  }
239
282
  }
240
283
  },
241
284
  inclusion: function(element, options) {
242
- var lower, message, upper, value;
243
- lower = null;
244
- upper = null;
245
- if ((message = this.presence(element, options)) && options.allow_blank === true) {} else if (message) {
285
+ var lower, message, o, upper, _ref;
286
+ message = this.presence(element, options);
287
+ if (message) {
288
+ if (options.allow_blank === true) return;
246
289
  return message;
247
- } else {
248
- if (options['in']) {
249
- for (value in options['in']) {
250
- if (value.toString() === element.val()) return;
251
- }
252
- return options.message;
253
- } else if (options.range) {
254
- lower = options.range[0];
255
- upper = options.range[1];
256
- if (element.val() >= lower && element.val() <= upper) {} else {
257
- return options.message;
290
+ }
291
+ if (options["in"]) {
292
+ if (_ref = element.val(), __indexOf.call((function() {
293
+ var _i, _len, _ref2, _results;
294
+ _ref2 = options["in"];
295
+ _results = [];
296
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
297
+ o = _ref2[_i];
298
+ _results.push(o.toString());
258
299
  }
300
+ return _results;
301
+ })(), _ref) >= 0) {
302
+ return;
259
303
  }
304
+ return options.message;
305
+ }
306
+ if (options.range) {
307
+ lower = options.range[0];
308
+ upper = options.range[1];
309
+ if (element.val() >= lower && element.val() <= upper) return;
310
+ return options.message;
260
311
  }
261
312
  },
262
313
  confirmation: function(element, options) {
263
- if (element.val() !== $("#" + (element.attr('id')) + "_confirmation").val()) {
314
+ if (element.val() !== jQuery("#" + (element.attr('id')) + "_confirmation").val()) {
264
315
  return options.message;
265
316
  }
266
317
  }
267
318
  },
268
319
  remote: {
269
320
  uniqueness: function(element, options) {
270
- var data, key, message, name, scoped_element;
271
- if ((message = ClientSideValidations.validators.local.presence(element, options)) && options.allow_blank === true) {} else if (message) {
321
+ var data, key, message, name, scope_value, scoped_element, scoped_name, _ref;
322
+ message = ClientSideValidations.validators.local.presence(element, options);
323
+ if (message) {
324
+ if (options.allow_blank === true) return;
272
325
  return message;
273
- } else {
274
- data = {};
275
- name = null;
276
- data.case_sensitive = !!options.case_sensitive;
277
- if (options.id) data.id = options.id;
278
- if (options.scope) {
279
- data.scope = {};
280
- for (key in options.scope) {
281
- scoped_element = $('[name="' + element.attr('name').replace(/\[\w+\]$/, '[' + key + ']' + '"]'));
282
- if (scoped_element[0] && scoped_element.val() !== options.scope[key]) {
283
- data.scope[key] = scoped_element.val();
284
- scoped_element.unbind("change." + element.id).bind("change." + element.id, function() {
285
- element.trigger('change');
286
- return element.trigger('focusout');
287
- });
288
- } else {
289
- data.scope[key] = options.scope[key];
290
- }
326
+ }
327
+ data = {};
328
+ data.case_sensitive = !!options.case_sensitive;
329
+ if (options.id) data.id = options.id;
330
+ if (options.scope) {
331
+ data.scope = {};
332
+ _ref = options.scope;
333
+ for (key in _ref) {
334
+ scope_value = _ref[key];
335
+ scoped_name = element.attr('name').replace(/\[\w+\]$/, "[" + key + "]");
336
+ scoped_element = jQuery("[name='" + scoped_name + "']");
337
+ if (scoped_element[0] && scoped_element.val() !== scope_value) {
338
+ data.scope[key] = scoped_element.val();
339
+ scoped_element.unbind("change." + element.id).bind("change." + element.id, function() {
340
+ element.trigger('change');
341
+ return element.trigger('focusout');
342
+ });
343
+ } else {
344
+ data.scope[key] = scope_value;
291
345
  }
292
346
  }
293
- if (/_attributes\]/.test(element.attr('name'))) {
294
- name = element.attr('name').match(/\[\w+_attributes\]/g).pop().match(/\[(\w+)_attributes\]/).pop();
295
- name += /(\[\w+\])$/.exec(element.attr('name'))[1];
296
- } else {
297
- name = element.attr('name');
298
- }
299
- if (options['class']) {
300
- name = "" + options['class'] + "[" + (name.split('[')[1]);
301
- }
302
- data[name] = element.val();
303
- if ($.ajax({
304
- url: '/validators/uniqueness',
305
- data: data,
306
- async: false
307
- }).status === 200) {
308
- return options.message;
309
- }
347
+ }
348
+ if (/_attributes\]/.test(element.attr('name'))) {
349
+ name = element.attr('name').match(/\[\w+_attributes\]/g).pop().match(/\[(\w+)_attributes\]/).pop();
350
+ name += /(\[\w+\])$/.exec(element.attr('name'))[1];
351
+ } else {
352
+ name = element.attr('name');
353
+ }
354
+ if (options['class']) name = options['class'] + '[' + name.split('[')[1];
355
+ data[name] = element.val();
356
+ if (jQuery.ajax({
357
+ url: '/validators/uniqueness',
358
+ data: data,
359
+ async: false
360
+ }).status === 200) {
361
+ return options.message;
310
362
  }
311
363
  }
312
364
  }
@@ -315,10 +367,10 @@
315
367
  'ActionView::Helpers::FormBuilder': {
316
368
  add: function(element, settings, message) {
317
369
  var inputErrorField, label, labelErrorField;
318
- if (element.data('valid') !== false && $("label.message[for='" + (element.attr('id')) + "']")[0] === void 0) {
319
- inputErrorField = $(settings.input_tag);
320
- labelErrorField = $(settings.label_tag);
321
- label = $("label[for='" + (element.attr('id')) + "']:not(.message)");
370
+ if (element.data('valid') !== false && !(jQuery("label.message[for='" + (element.attr('id')) + "']")[0] != null)) {
371
+ inputErrorField = jQuery(settings.input_tag);
372
+ labelErrorField = jQuery(settings.label_tag);
373
+ label = jQuery("label[for='" + (element.attr('id')) + "']:not(.message)");
322
374
  if (element.attr('autofocus')) element.attr('autofocus', false);
323
375
  element.before(inputErrorField);
324
376
  inputErrorField.find('span#input_tag').replaceWith(element);
@@ -327,13 +379,13 @@
327
379
  label.replaceWith(labelErrorField);
328
380
  labelErrorField.find('label#label_tag').replaceWith(label);
329
381
  }
330
- return $("label.message[for='" + (element.attr('id')) + "']").text(message);
382
+ return jQuery("label.message[for='" + (element.attr('id')) + "']").text(message);
331
383
  },
332
384
  remove: function(element, settings) {
333
385
  var errorFieldClass, inputErrorField, label, labelErrorField;
334
- errorFieldClass = $(settings.input_tag).attr('class');
386
+ errorFieldClass = jQuery(settings.input_tag).attr('class');
335
387
  inputErrorField = element.closest("." + errorFieldClass);
336
- label = $("label[for='" + (element.attr('id')) + "']:not(.message)");
388
+ label = jQuery("label[for='" + (element.attr('id')) + "']:not(.message)");
337
389
  labelErrorField = label.closest("." + errorFieldClass);
338
390
  if (inputErrorField[0]) {
339
391
  inputErrorField.find("#" + (element.attr('id'))).detach();
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: 3.2.0.beta.2
4
+ version: 3.2.0.beta.3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-25 00:00:00.000000000Z
12
+ date: 2012-03-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70281071642860 !ruby/object:Gem::Requirement
16
+ requirement: &70115631263420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70281071642860
24
+ version_requirements: *70115631263420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &70281071642120 !ruby/object:Gem::Requirement
27
+ requirement: &70115631263000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70281071642120
35
+ version_requirements: *70115631263000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mocha
38
- requirement: &70281071641060 !ruby/object:Gem::Requirement
38
+ requirement: &70115631262540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70281071641060
46
+ version_requirements: *70115631262540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sinatra
49
- requirement: &70281071640160 !ruby/object:Gem::Requirement
49
+ requirement: &70115631262040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '1.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70281071640160
57
+ version_requirements: *70115631262040
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: shotgun
60
- requirement: &70281071639680 !ruby/object:Gem::Requirement
60
+ requirement: &70115631261620 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70281071639680
68
+ version_requirements: *70115631261620
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thin
71
- requirement: &70281071639200 !ruby/object:Gem::Requirement
71
+ requirement: &70115651537880 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70281071639200
79
+ version_requirements: *70115651537880
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: json
82
- requirement: &70281071638700 !ruby/object:Gem::Requirement
82
+ requirement: &70115651537460 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70281071638700
90
+ version_requirements: *70115651537460
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: coffee-script
93
- requirement: &70281071638160 !ruby/object:Gem::Requirement
93
+ requirement: &70115651537040 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70281071638160
101
+ version_requirements: *70115651537040
102
102
  description: Client Side Validations
103
103
  email:
104
104
  - bcardarella@gmail.com
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: 1.3.1
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 1.8.10
159
+ rubygems_version: 1.8.15
160
160
  signing_key:
161
161
  specification_version: 3
162
162
  summary: Client Side Validations