bootstrap-guardsjs-rails 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ac2124dc5c54a4759719c3c473f601fa4657d32
|
4
|
+
data.tar.gz: 68ea702596fc9f61915b8d7ae7f4b4e12507ab16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81edf2a66e36b79fee95a944151aaa8b602e09f31285343f5cbcb87384d5632c37a41f63e0cceb471f79ec0d6b089a4af45f2877a47e4167221d6af89681c81d
|
7
|
+
data.tar.gz: 5aba69ba2abb31b454f28eb657ab5d0958d89243e996ec311a2c067000d1a4e926c5f839bd160aa78ce6d093c1be66c90540eb2e7a946284614b9bcc6f7a14a9
|
@@ -0,0 +1,33 @@
|
|
1
|
+
//= require guards
|
2
|
+
|
3
|
+
;(function($) {
|
4
|
+
var originalDefaultTarget = $.guards.defaults.target;
|
5
|
+
|
6
|
+
// Ensure input-appended and input-prepended inputs have errors
|
7
|
+
// placed in the proper location.
|
8
|
+
$.guards.defaults.target = function(errorElement) {
|
9
|
+
if (!$(this).parent().is(".input-append") && !$(this).parent().is(".input-prepend")) {
|
10
|
+
return originalDefaultTarget.call(this, errorElement);
|
11
|
+
}
|
12
|
+
|
13
|
+
errorElement.insertAfter($(this).parent());
|
14
|
+
return false;
|
15
|
+
};
|
16
|
+
|
17
|
+
// Make sure the error message class is the correct class.
|
18
|
+
$.guards.defaults.messageClass = "help-inline";
|
19
|
+
|
20
|
+
// Add the error to the proper control group parent.
|
21
|
+
$(document).on("afterGuardError", ":guardable", function(e) {
|
22
|
+
$(e.errorElements).each(function() {
|
23
|
+
$(this).parents(".control-group:first").addClass("error");
|
24
|
+
});
|
25
|
+
});
|
26
|
+
|
27
|
+
// Remove the error from the control on clear.
|
28
|
+
$(document).on("afterClearGuardError", ":guardable", function(e) {
|
29
|
+
$(e.errorElements).each(function() {
|
30
|
+
$(this).parents(".control-group:first").removeClass("error");
|
31
|
+
});
|
32
|
+
});
|
33
|
+
})(jQuery);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
//= require guards
|
2
|
+
|
3
|
+
;(function($) {
|
4
|
+
var originalDefaultTarget = $.guards.defaults.target;
|
5
|
+
|
6
|
+
// Ensure input-group inputs have errors placed in the proper
|
7
|
+
// location.
|
8
|
+
$.guards.defaults.target = function(errorElement) {
|
9
|
+
if (!$(this).parent().is(".input-group")) {
|
10
|
+
return originalDefaultTarget.call(this, errorElement);
|
11
|
+
}
|
12
|
+
|
13
|
+
errorElement.insertAfter($(this).parent());
|
14
|
+
return false;
|
15
|
+
};
|
16
|
+
|
17
|
+
// Make sure the error message class is the correct class.
|
18
|
+
$.guards.defaults.messageClass = "help-block";
|
19
|
+
|
20
|
+
// Add the error to the proper control group parent.
|
21
|
+
$(document).on("afterGuardError", ":guardable", function(e) {
|
22
|
+
$(e.errorElements).each(function() {
|
23
|
+
if ($(this).is("[data-show-optional-icon]")) {
|
24
|
+
var icon = $(this).data("show-optional-icon");
|
25
|
+
|
26
|
+
if ($.guards.isBlank(icon)) {
|
27
|
+
icon = "remove";
|
28
|
+
}
|
29
|
+
|
30
|
+
$(this).parents(".form-group:first").addClass("has-feedback").append("<span class=\"glyphicon glyphicon-" + icon + " form-control-feedback\" data-generated-by-guards></span>");
|
31
|
+
}
|
32
|
+
|
33
|
+
$(this).parents(".form-group:first").addClass("has-error");
|
34
|
+
});
|
35
|
+
});
|
36
|
+
|
37
|
+
$(document).on("afterClearGuardError", ":guardable", function(e) {
|
38
|
+
$(e.errorElements).each(function() {
|
39
|
+
if ($(this).is("[data-show-optional-icon]")) {
|
40
|
+
$(this).parents(".form-group:first").removeClass("has-feedback").find("[data-generated-by-guards]").remove();
|
41
|
+
}
|
42
|
+
|
43
|
+
$(this).parents(".form-group:first").removeClass("has-error");
|
44
|
+
});
|
45
|
+
});
|
46
|
+
})(jQuery);
|
@@ -1,33 +1 @@
|
|
1
|
-
//= require guards
|
2
|
-
|
3
|
-
;(function($) {
|
4
|
-
var originalDefaultTarget = $.guards.defaults.target;
|
5
|
-
|
6
|
-
// Ensure input-appended and input-prepended inputs have errors
|
7
|
-
// placed in the proper location.
|
8
|
-
$.guards.defaults.target = function(errorElement) {
|
9
|
-
if (!$(this).parent().is(".input-append") && !$(this).parent().is(".input-prepend")) {
|
10
|
-
return originalDefaultTarget.call(this, errorElement);
|
11
|
-
}
|
12
|
-
|
13
|
-
errorElement.insertAfter($(this).parent());
|
14
|
-
return false;
|
15
|
-
};
|
16
|
-
|
17
|
-
// Make sure the error message class is the correct class.
|
18
|
-
$.guards.defaults.messageClass = "help-inline";
|
19
|
-
|
20
|
-
// Add the error to the proper control group parent.
|
21
|
-
$(document).on("afterGuardError", ":guardable", function(e) {
|
22
|
-
$(e.errorElements).each(function() {
|
23
|
-
$(this).parents(".control-group:first").addClass("error");
|
24
|
-
});
|
25
|
-
});
|
26
|
-
|
27
|
-
// Remove the error from the control on clear.
|
28
|
-
$(document).on("afterClearGuardError", ":guardable", function(e) {
|
29
|
-
$(e.errorElements).each(function() {
|
30
|
-
$(this).parents(".control-group:first").removeClass("error");
|
31
|
-
});
|
32
|
-
});
|
33
|
-
})(jQuery);
|
1
|
+
//= require bootstrap-3-guards
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-guardsjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Virata-Stone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -52,6 +52,8 @@ executables: []
|
|
52
52
|
extensions: []
|
53
53
|
extra_rdoc_files: []
|
54
54
|
files:
|
55
|
+
- app/assets/javascripts/bootstrap-2-guards.js
|
56
|
+
- app/assets/javascripts/bootstrap-3-guards.js
|
55
57
|
- app/assets/javascripts/bootstrap-guards.js
|
56
58
|
- lib/bootstrap-guardsjs-rails.rb
|
57
59
|
- lib/bootstrap-guardsjs-rails/version.rb
|