realtime-validations 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,15 @@
|
|
1
|
-
var
|
1
|
+
var RealtimeValidations = {
|
2
2
|
|
3
3
|
bind_fields : function() {
|
4
4
|
$('form[validation="true"] :input').each(function(i, field) {
|
5
|
-
|
5
|
+
RealtimeValidations.bind_field(field);
|
6
6
|
});
|
7
7
|
},
|
8
8
|
|
9
9
|
bind_field : function(field) {
|
10
10
|
var field_to_validate = $('#' + field.id);
|
11
|
-
if (
|
12
|
-
field_to_validate.blur(
|
11
|
+
if (RealtimeValidations.should_bind_field(field_to_validate)) {
|
12
|
+
field_to_validate.blur(RealtimeValidations.bind_field_on_blur);
|
13
13
|
}
|
14
14
|
},
|
15
15
|
|
@@ -24,7 +24,7 @@ var RealTimeValidations = {
|
|
24
24
|
bind_field_on_blur : function() {
|
25
25
|
var field = $(this);
|
26
26
|
var form_to_validate = $('form[validation="true"]');
|
27
|
-
var validation_path =
|
27
|
+
var validation_path = RealtimeValidations.path(form_to_validate);
|
28
28
|
var model = form_to_validate.attr('model');
|
29
29
|
var field_name = field.attr('name');
|
30
30
|
var matched = field_name.match(/(\w+)\[(\w+)_confirmation\]/);
|
@@ -41,14 +41,14 @@ var RealTimeValidations = {
|
|
41
41
|
data_to_send = { field: field_name, value: current_value, model: model };
|
42
42
|
}
|
43
43
|
|
44
|
-
var custom_data_to_send =
|
44
|
+
var custom_data_to_send = RealtimeValidations.customFields();
|
45
45
|
$.extend(data_to_send, custom_data_to_send);
|
46
46
|
|
47
47
|
$.post(validation_path, data_to_send, function(data) {
|
48
48
|
if ($.isEmptyObject(data.errors)) {
|
49
|
-
|
49
|
+
RealtimeValidations.hide_warning_message(field);
|
50
50
|
} else {
|
51
|
-
|
51
|
+
RealtimeValidations.show_warning_message(field, data.errors);
|
52
52
|
}
|
53
53
|
});
|
54
54
|
},
|
@@ -89,7 +89,7 @@ var RealTimeValidations = {
|
|
89
89
|
|
90
90
|
};
|
91
91
|
|
92
|
-
$(document).ready(
|
92
|
+
$(document).ready(RealtimeValidations.bind_fields);
|
93
93
|
|
94
94
|
$(document).ajaxSend(function(e, xhr, options) {
|
95
95
|
var token = $("meta[name='csrf-token']").attr("content");
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: realtime-validations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &11530720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *11530720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &11526960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *11526960
|
36
36
|
description: Form real time validations for free on Rails applications
|
37
37
|
email:
|
38
38
|
- ereslibre@gmail.com
|