nimboids-client_side_validations 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/client_side_validations.gemspec +45 -0
  2. data/javascript/rails.validations.js +393 -0
  3. data/lib/client_side_validations.rb +8 -0
  4. data/lib/client_side_validations/action_view.rb +13 -0
  5. data/lib/client_side_validations/action_view/form_builder.rb +64 -0
  6. data/lib/client_side_validations/action_view/form_helper.rb +69 -0
  7. data/lib/client_side_validations/action_view/form_tag_helper.rb +12 -0
  8. data/lib/client_side_validations/active_model.rb +52 -0
  9. data/lib/client_side_validations/active_model/acceptance.rb +10 -0
  10. data/lib/client_side_validations/active_model/exclusion.rb +15 -0
  11. data/lib/client_side_validations/active_model/format.rb +10 -0
  12. data/lib/client_side_validations/active_model/inclusion.rb +15 -0
  13. data/lib/client_side_validations/active_model/length.rb +22 -0
  14. data/lib/client_side_validations/active_model/numericality.rb +26 -0
  15. data/lib/client_side_validations/active_model/presence.rb +10 -0
  16. data/lib/client_side_validations/active_record.rb +11 -0
  17. data/lib/client_side_validations/active_record/middleware.rb +25 -0
  18. data/lib/client_side_validations/active_record/uniqueness.rb +26 -0
  19. data/lib/client_side_validations/core_ext.rb +3 -0
  20. data/lib/client_side_validations/core_ext/range.rb +10 -0
  21. data/lib/client_side_validations/core_ext/regexp.rb +14 -0
  22. data/lib/client_side_validations/formtastic.rb +21 -0
  23. data/lib/client_side_validations/middleware.rb +83 -0
  24. data/lib/client_side_validations/mongoid.rb +9 -0
  25. data/lib/client_side_validations/mongoid/middleware.rb +20 -0
  26. data/lib/client_side_validations/mongoid/uniqueness.rb +26 -0
  27. data/lib/client_side_validations/simple_form.rb +24 -0
  28. data/lib/client_side_validations/version.rb +3 -0
  29. data/lib/generators/client_side_validations/install_generator.rb +22 -0
  30. data/lib/generators/templates/README +7 -0
  31. data/lib/generators/templates/client_side_validations.rb +14 -0
  32. data/test/action_view/cases/helper.rb +152 -0
  33. data/test/action_view/cases/test_helpers.rb +237 -0
  34. data/test/action_view/cases/test_legacy_helpers.rb +150 -0
  35. data/test/action_view/models.rb +3 -0
  36. data/test/action_view/models/comment.rb +35 -0
  37. data/test/action_view/models/post.rb +35 -0
  38. data/test/active_model/cases/helper.rb +4 -0
  39. data/test/active_model/cases/test_acceptance_validator.rb +16 -0
  40. data/test/active_model/cases/test_base.rb +11 -0
  41. data/test/active_model/cases/test_confirmation_validator.rb +16 -0
  42. data/test/active_model/cases/test_exclusion_validator.rb +20 -0
  43. data/test/active_model/cases/test_format_validator.rb +21 -0
  44. data/test/active_model/cases/test_inclusion_validator.rb +21 -0
  45. data/test/active_model/cases/test_length_validator.rb +61 -0
  46. data/test/active_model/cases/test_numericality_validator.rb +46 -0
  47. data/test/active_model/cases/test_presence_validator.rb +16 -0
  48. data/test/active_model/cases/test_validations.rb +151 -0
  49. data/test/active_model/models/person.rb +17 -0
  50. data/test/active_record/cases/helper.rb +12 -0
  51. data/test/active_record/cases/test_base.rb +11 -0
  52. data/test/active_record/cases/test_middleware.rb +150 -0
  53. data/test/active_record/cases/test_uniqueness_validator.rb +45 -0
  54. data/test/active_record/models/guid.rb +7 -0
  55. data/test/active_record/models/user.rb +10 -0
  56. data/test/base_helper.rb +6 -0
  57. data/test/core_ext/cases/test_core_ext.rb +45 -0
  58. data/test/formtastic/cases/helper.rb +2 -0
  59. data/test/formtastic/cases/test_form_builder.rb +11 -0
  60. data/test/formtastic/cases/test_form_helper.rb +22 -0
  61. data/test/generators/cases/test_install_generator.rb +15 -0
  62. data/test/javascript/config.ru +3 -0
  63. data/test/javascript/public/test/callbacks/elementAfter.js +54 -0
  64. data/test/javascript/public/test/callbacks/elementBefore.js +54 -0
  65. data/test/javascript/public/test/callbacks/elementFail.js +70 -0
  66. data/test/javascript/public/test/callbacks/elementPass.js +70 -0
  67. data/test/javascript/public/test/callbacks/formAfter.js +45 -0
  68. data/test/javascript/public/test/callbacks/formBefore.js +45 -0
  69. data/test/javascript/public/test/callbacks/formFail.js +51 -0
  70. data/test/javascript/public/test/callbacks/formPass.js +50 -0
  71. data/test/javascript/public/test/form_builders/validateForm.js +66 -0
  72. data/test/javascript/public/test/form_builders/validateFormtastic.js +54 -0
  73. data/test/javascript/public/test/form_builders/validateSimpleForm.js +57 -0
  74. data/test/javascript/public/test/settings.js +15 -0
  75. data/test/javascript/public/test/validateElement.js +144 -0
  76. data/test/javascript/public/test/validators/acceptance.js +42 -0
  77. data/test/javascript/public/test/validators/confirmation.js +25 -0
  78. data/test/javascript/public/test/validators/exclusion.js +41 -0
  79. data/test/javascript/public/test/validators/format.js +27 -0
  80. data/test/javascript/public/test/validators/inclusion.js +42 -0
  81. data/test/javascript/public/test/validators/length.js +70 -0
  82. data/test/javascript/public/test/validators/numericality.js +140 -0
  83. data/test/javascript/public/test/validators/presence.js +15 -0
  84. data/test/javascript/public/test/validators/uniqueness.js +89 -0
  85. data/test/javascript/public/vendor/jquery.metadata.js +122 -0
  86. data/test/javascript/public/vendor/qunit.css +196 -0
  87. data/test/javascript/public/vendor/qunit.js +1374 -0
  88. data/test/javascript/server.rb +78 -0
  89. data/test/javascript/views/index.erb +20 -0
  90. data/test/javascript/views/layout.erb +21 -0
  91. data/test/middleware/cases/helper.rb +15 -0
  92. data/test/middleware/cases/test_middleware.rb +8 -0
  93. data/test/mongoid/cases/helper.rb +16 -0
  94. data/test/mongoid/cases/test_base.rb +15 -0
  95. data/test/mongoid/cases/test_middleware.rb +68 -0
  96. data/test/mongoid/cases/test_uniqueness_validator.rb +44 -0
  97. data/test/mongoid/models/book.rb +8 -0
  98. data/test/simple_form/cases/helper.rb +2 -0
  99. data/test/simple_form/cases/test_form_builder.rb +14 -0
  100. data/test/simple_form/cases/test_form_helper.rb +22 -0
  101. metadata +435 -0
@@ -0,0 +1,45 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "client_side_validations/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "nimboids-client_side_validations"
7
+ s.version = ClientSideValidations::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Brian Cardarella"]
10
+ s.email = ["bcardarella@gmail.com"]
11
+ s.homepage = "https://github.com/nimboids/client_side_validations"
12
+ s.summary = %q{Client Side Validations}
13
+ s.description = %q{Client Side Validations}
14
+
15
+ s.rubyforge_project = "client_side_validations"
16
+
17
+ s.files = `git ls-files -- {lib/*,javascript/*,*.gemspec}`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency 'activesupport', '~> 3.0.0'
23
+
24
+ s.add_development_dependency 'rails', '~> 3.0.0'
25
+ s.add_development_dependency 'sqlite3'
26
+ s.add_development_dependency 'bson_ext'
27
+ s.add_development_dependency 'mongoid', '~> 2.0.0'
28
+ s.add_development_dependency 'mocha'
29
+ s.add_development_dependency 'simple_form'
30
+ s.add_development_dependency 'formtastic'
31
+
32
+ # For QUnit testing
33
+ s.add_development_dependency 'sinatra', '~> 1.0'
34
+ s.add_development_dependency 'shotgun'
35
+ s.add_development_dependency 'thin'
36
+ s.add_development_dependency 'json'
37
+
38
+ ruby_minor_version = RUBY_VERSION.split('.')[1].to_i
39
+ if ruby_minor_version == 8
40
+ s.add_development_dependency 'minitest'
41
+ s.add_development_dependency 'ruby-debug'
42
+ elsif ruby_minor_version == 9
43
+ s.add_development_dependency 'ruby-debug19'
44
+ end
45
+ end
@@ -0,0 +1,393 @@
1
+ /*!
2
+ * Rails 3 Client Side Validations - v3.0.1
3
+ * https://github.com/bcardarlela/client_side_validations
4
+ *
5
+ * Copyright (c) 2011 Brian Cardarella
6
+ * Licensed under the MIT license
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ (function($) {
11
+ $.fn.validate = function() {
12
+ return this.filter('form[data-validate]').each(function() {
13
+ var form = $(this);
14
+ var settings = window[form.attr('id')];
15
+
16
+ // Set up the events for the form
17
+ form
18
+ .submit(function() { return form.isValid(settings.validators); })
19
+ .bind('ajax:beforeSend', function() { return form.isValid(settings.validators); })
20
+ // 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); })
25
+
26
+ // Set up the events for each validatable form element
27
+ .find('[data-validate]:input')
28
+ .live('focusout', function() { $(this).isValid(settings.validators); })
29
+ .live('change', function() { $(this).data('changed', true); })
30
+ // 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) {
34
+ var element = $(this);
35
+ clientSideValidations.callbacks.element.fail(element, message, function() {
36
+ addError(element, message);
37
+ }, eventData) })
38
+ .live('element:validate:pass', function(eventData) {
39
+ var element = $(this);
40
+ clientSideValidations.callbacks.element.pass(element, function() {
41
+ removeError(element);
42
+ }, eventData) })
43
+ // Checkboxes - Live events don't support filter
44
+ .end().find('[data-validate]:checkbox')
45
+ .live('click', function() { $(this).isValid(settings.validators); })
46
+ // Inputs for confirmations
47
+ .end().find('[id*=_confirmation]').each(function() {
48
+ var confirmationElement = $(this),
49
+ element = form.find('#' + this.id.match(/(.+)_confirmation/)[1] + '[data-validate]:input');
50
+
51
+ $('#' + confirmationElement.attr('id'))
52
+ .live('focusout', function() {
53
+ element.data('changed', true).isValid(settings.validators);
54
+ })
55
+ .live('keyup', function() {
56
+ element.data('changed', true).isValid(settings.validators);
57
+ })
58
+ });
59
+
60
+ var addError = function(element, message) {
61
+ clientSideValidations.formBuilders[settings.type].add(element, settings, message);
62
+ }
63
+
64
+ var removeError = function(element) {
65
+ clientSideValidations.formBuilders[settings.type].remove(element, settings);
66
+ }
67
+ });
68
+ }
69
+
70
+ $.fn.isValid = function(validators) {
71
+ if ($(this[0]).is('form')) {
72
+ return validateForm($(this[0]), validators);
73
+ } else {
74
+ return validateElement($(this[0]), validators[this[0].name]);
75
+ }
76
+ }
77
+
78
+ var validateForm = function(form, validators) {
79
+ var valid = true;
80
+
81
+ form.trigger('form:validate:before').find('[data-validate]:input').each(function() {
82
+ if (!$(this).isValid(validators)) { valid = false; }
83
+ });
84
+
85
+ if (valid) {
86
+ form.trigger('form:validate:pass');
87
+ } else {
88
+ form.trigger('form:validate:fail');
89
+ }
90
+
91
+ form.trigger('form:validate:after');
92
+ return valid;
93
+ }
94
+
95
+ var 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
+ }
110
+ }
111
+
112
+ if (valid) { element.data('valid', null); element.trigger('element:validate:pass'); }
113
+ }
114
+
115
+ element.trigger('element:validate:after');
116
+ return element.data('valid') === false ? false : true;
117
+ }
118
+
119
+ // Main hook
120
+ // If new forms are dynamically introduced into the DOM the .validate() method
121
+ // must be invoked on that form
122
+ $(function() { $('form[data-validate]').validate(); })
123
+ })(jQuery);
124
+
125
+ var clientSideValidations = {
126
+ validators: {
127
+ all: function() { return jQuery.extend({}, clientSideValidations.validators.local, clientSideValidations.validators.remote) },
128
+ local: {
129
+ presence: function(element, options) {
130
+ if (/^\s*$/.test(element.val())) {
131
+ return options.message;
132
+ }
133
+ },
134
+ acceptance: function(element, options) {
135
+ switch (element.attr('type')) {
136
+ case 'checkbox':
137
+ if (!element.attr('checked')) {
138
+ return options.message;
139
+ }
140
+ break;
141
+ case 'text':
142
+ if (element.val() != (options.accept || '1')) {
143
+ return options.message;
144
+ }
145
+ break;
146
+ }
147
+ },
148
+ format: function(element, options) {
149
+ if ((message = this.presence(element, options)) && options.allow_blank == true) {
150
+ return;
151
+ } else if (message) {
152
+ return message;
153
+ } else {
154
+ if (options['with'] && !options['with'].test(element.val())) {
155
+ return options.message;
156
+ } else if (options['without'] && options['without'].test(element.val())) {
157
+ return options.message;
158
+ }
159
+ }
160
+ },
161
+ numericality: function(element, options) {
162
+ if ((message = this.presence(element, options)) && options.allow_blank == true) {
163
+ return;
164
+ }
165
+
166
+ if (!/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d*)?$/.test(element.val())) {
167
+ return options.messages.numericality;
168
+ }
169
+
170
+ if (options.only_integer && !/^\d+$/.test(element.val())) {
171
+ return options.messages.only_integer;
172
+ }
173
+
174
+ var CHECKS = { greater_than: '>', greater_than_or_equal_to: '>=',
175
+ equal_to: '==', less_than: '<', less_than_or_equal_to: '<=' }
176
+
177
+ for (var check in CHECKS) {
178
+ if (options[check] && !(new Function("return " + element.val() + CHECKS[check] + options[check])())) {
179
+ return options.messages[check];
180
+ }
181
+ }
182
+
183
+ if (options.odd && !(parseInt(element.val()) % 2)) {
184
+ return options.messages.odd;
185
+ }
186
+
187
+ if (options.even && (parseInt(element.val()) % 2)) {
188
+ return options.messages.even;
189
+ }
190
+ },
191
+ length: function(element, options) {
192
+ var blankOptions = {};
193
+ if (options.is) {
194
+ blankOptions.message = options.messages.is;
195
+ } else if (options.minimum) {
196
+ blankOptions.message = options.messages.minimum;
197
+ }
198
+ if ((message = this.presence(element, blankOptions)) && options.allow_blank == true && !options.maximum) {
199
+ return;
200
+ } else if (message) {
201
+ return message;
202
+ } else {
203
+ var CHECKS = { is: '==', minimum: '>=', maximum: '<=' }
204
+ var tokenizer = options.js_tokenizer || "split('')";
205
+ var tokenized_length = new Function("element", "return (element.val()." + tokenizer + " || '').length;")(element);
206
+
207
+ for (var check in CHECKS) {
208
+ if (options[check] && !(new Function("return " + tokenized_length + CHECKS[check] + options[check])())) {
209
+ return options.messages[check];
210
+ }
211
+ }
212
+ }
213
+ },
214
+ exclusion: function(element, options) {
215
+ if ((message = this.presence(element, options)) && options.allow_blank == true) {
216
+ return;
217
+ } else if (message) {
218
+ return message;
219
+ } else {
220
+ if (options['in']) {
221
+ for (var i = 0; i < options['in'].length; i++) {
222
+ if (options['in'][i] == element.val()) {
223
+ return options.message;
224
+ }
225
+ }
226
+ } else if (options['range']) {
227
+ var lower = options['range'][0],
228
+ upper = options['range'][1];
229
+ if (element.val() >= lower && element.val() <= upper) {
230
+ return options.message;
231
+ }
232
+ }
233
+ }
234
+ },
235
+ inclusion: function(element, options) {
236
+ if ((message = this.presence(element, options)) && options.allow_blank == true) {
237
+ return;
238
+ } else if (message) {
239
+ return message;
240
+ } else {
241
+ if (options['in']) {
242
+ for (var i = 0; i < options['in'].length; i++) {
243
+ if (options['in'][i] == element.val()) {
244
+ return;
245
+ }
246
+ }
247
+ return options.message;
248
+ } else if (options['range']) {
249
+ var lower = options['range'][0],
250
+ upper = options['range'][1];
251
+
252
+ if (element.val() >= lower && element.val() <= upper) {
253
+ return;
254
+ } else {
255
+ return options.message;
256
+ }
257
+ }
258
+ }
259
+ },
260
+ confirmation: function(element, options) {
261
+ if (element.val() != jQuery('#' + element.attr('id') + '_confirmation').val()) {
262
+ return options.message;
263
+ }
264
+ }
265
+ },
266
+ remote: {
267
+ uniqueness: function(element, options) {
268
+ var data = {};
269
+ data['case_sensitive'] = !!options.case_sensitive;
270
+ if (options.id) {
271
+ data['id'] = options.id;
272
+ }
273
+
274
+ if (options.scope) {
275
+ data.scope = {}
276
+ for (key in options.scope) {
277
+ var scoped_element = jQuery('[name="' + element.attr('name').replace(/\[\w+]$/, '[' + key + ']' + '"]'));
278
+ if (scoped_element[0] && scoped_element.val() != options.scope[key]) {
279
+ data.scope[key] = scoped_element.val();
280
+ scoped_element.unbind('change.' + element.id).bind('change.' + element.id, function() { element.trigger('change'); element.trigger('focusout'); });
281
+ } else {
282
+ data.scope[key] = options.scope[key];
283
+ }
284
+ }
285
+ }
286
+
287
+ // Kind of a hack but this will isolate the resource name and attribute.
288
+ // e.g. user[records_attributes][0][title] => records[title]
289
+ // e.g. user[record_attributes][title] => record[title]
290
+ // Server side handles classifying the resource properly
291
+ if (/_attributes]/.test(element.attr('name'))) {
292
+ var name = element.attr('name').match(/\[\w+_attributes]/g).pop().match(/\[(\w+)_attributes]/).pop();
293
+ name += /(\[\w+])$/.exec(element.attr('name'))[1];
294
+ } else {
295
+ var name = element.attr('name');
296
+ }
297
+ data[name] = element.val();
298
+
299
+ if (jQuery.ajax({
300
+ url: '/validators/uniqueness.json',
301
+ data: data,
302
+ async: false
303
+ }).status == 200) {
304
+ return options.message;
305
+ }
306
+ }
307
+ }
308
+ },
309
+ formBuilders: {
310
+ 'ActionView::Helpers::FormBuilder': {
311
+ add: function(element, settings, message) {
312
+ if (element.data('valid') !== false) {
313
+ var inputErrorField = jQuery(settings.input_tag),
314
+ labelErrorField = jQuery(settings.label_tag),
315
+ label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)');
316
+
317
+ if (element.attr('autofocus')) { element.attr('autofocus', false) };
318
+ element.before(inputErrorField);
319
+ inputErrorField.find('span#input_tag').replaceWith(element);
320
+ inputErrorField.find('label.message').attr('for', element.attr('id'));
321
+ label.replaceWith(labelErrorField);
322
+ labelErrorField.find('label#label_tag').replaceWith(label);
323
+ }
324
+ jQuery('label.message[for="' + element.attr('id') + '"]').text(message);
325
+ },
326
+ remove: function(element, settings) {
327
+ var errorFieldClass = jQuery(settings.input_tag).attr('class'),
328
+ inputErrorField = element.closest('.' + errorFieldClass),
329
+ label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)'),
330
+ labelErrorField = label.closest('.' + errorFieldClass);
331
+
332
+ if (inputErrorField[0]) {
333
+ inputErrorField.find('#' + element.attr('id')).detach();
334
+ inputErrorField.replaceWith(element);
335
+ label.detach();
336
+ labelErrorField.replaceWith(label);
337
+ }
338
+ }
339
+ },
340
+ 'SimpleForm::FormBuilder': {
341
+ add: function(element, settings, message) {
342
+ if (element.data('valid') !== false) {
343
+ var wrapper = element.closest(settings.wrapper_tag);
344
+ wrapper.addClass(settings.wrapper_error_class);
345
+ var errorElement = $('<' + settings.error_tag + ' class="' + settings.error_class + '">' + message + '</' + settings.error_tag + '>');
346
+ wrapper.append(errorElement);
347
+ } else {
348
+ element.parent().find(settings.error_tag + '.' + settings.error_class).text(message);
349
+ }
350
+ },
351
+ remove: function(element, settings) {
352
+ var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_error_class);
353
+ wrapper.removeClass(settings.wrapper_error_class);
354
+ var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class);
355
+ errorElement.remove();
356
+ }
357
+
358
+ },
359
+ 'Formtastic::SemanticFormBuilder': {
360
+ add: function(element, settings, message) {
361
+ if (element.data('valid') !== false) {
362
+ var wrapper = element.closest('li');
363
+ wrapper.addClass('error');
364
+ var errorElement = $('<p class="' + settings.inline_error_class + '">' + message + '</p>');
365
+ wrapper.append(errorElement);
366
+ } else {
367
+ element.parent().find('p.' + settings.inline_error_class).text(message);
368
+ }
369
+ },
370
+ remove: function(element, settings) {
371
+ var wrapper = element.closest('li.error');
372
+ wrapper.removeClass('error');
373
+ var errorElement = wrapper.find('p.' + settings.inline_error_class);
374
+ errorElement.remove();
375
+ }
376
+
377
+ }
378
+ },
379
+ callbacks: {
380
+ element: {
381
+ after: function(element, eventData) { },
382
+ before: function(element, eventData) { },
383
+ fail: function(element, message, addError, eventData) { addError() },
384
+ pass: function(element, removeError, eventData) { removeError() }
385
+ },
386
+ form: {
387
+ after: function(form, eventData) { },
388
+ before: function(form, eventData) { },
389
+ fail: function(form, eventData) { },
390
+ pass: function(form, eventData) { }
391
+ }
392
+ }
393
+ }
@@ -0,0 +1,8 @@
1
+ module ClientSideValidations
2
+ end
3
+
4
+ require 'client_side_validations/active_record' if defined?(::ActiveRecord)
5
+ require 'client_side_validations/mongoid' if defined?(::Mongoid)
6
+ require 'client_side_validations/action_view'
7
+ require 'client_side_validations/middleware' if defined?(::Rails)
8
+
@@ -0,0 +1,13 @@
1
+ module ClientSideValidations::ActionView
2
+ module Helpers
3
+ end
4
+ end
5
+
6
+ require "client_side_validations/action_view/form_helper"
7
+ require "client_side_validations/action_view/form_tag_helper"
8
+ require "client_side_validations/action_view/form_builder"
9
+
10
+ ActionView::Base.send(:include, ClientSideValidations::ActionView::Helpers::FormHelper)
11
+ ActionView::Base.send(:include, ClientSideValidations::ActionView::Helpers::FormTagHelper)
12
+ ActionView::Helpers::FormBuilder.send(:include, ClientSideValidations::ActionView::Helpers::FormBuilder)
13
+