jSignature 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jSignature/railtie.rb +2 -0
- data/lib/jSignature/view_helpers.rb +16 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13638326a5b58fddf69c6f9e03e16b8e7b562a30
|
4
|
+
data.tar.gz: 2a8336912c98d7b2240a683209a8e1fae601e9be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d08491c674f766b37dc8afc85f84484b545b96bf5bd013c0a851585725a9f5c0234d48a142fc66707e982f6b1618e7d9f4544788239d23ac7e14d70beaf5edc3
|
7
|
+
data.tar.gz: 93ff293c3c771e7dd1752922058429f916fb1886f7ca7888da34d663afc01902b85b64596d3c29ffca8796a469a4535f014256893cdb986fe135d64478bf0134
|
data/lib/jSignature/railtie.rb
CHANGED
@@ -4,6 +4,8 @@ module JSignature
|
|
4
4
|
class Railtie < Rails::Railtie
|
5
5
|
initializer "jSignature.view_helpers" do |app|
|
6
6
|
ActionView::Base.send :include, ViewHelpers
|
7
|
+
ActionView::Helpers::FormBuilder.send :include, ViewHelpers
|
8
|
+
ActionView::Helpers::FormHelper.send :include, ViewHelpers
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,15 +1,29 @@
|
|
1
|
+
include ActionView::Helpers::TagHelper
|
2
|
+
|
1
3
|
module JSignature
|
2
4
|
module ViewHelpers
|
3
|
-
def
|
5
|
+
def sign_form_field_tag(name)
|
4
6
|
render :inline => "<%= text_field_tag(:#{name},\"\", :hidden => true) %>
|
5
7
|
<div id='#{name}_sig'></div><script> $(document).ready(function() {
|
6
8
|
var x = $('##{name}_sig');
|
7
|
-
x.jSignature(
|
9
|
+
x.jSignature();
|
8
10
|
x.change(function(){
|
9
11
|
$('##{name}').val(x.jSignature('getData'));
|
10
12
|
});
|
11
13
|
|
12
14
|
});</script>"
|
13
15
|
end
|
16
|
+
|
17
|
+
def sign_field(name)
|
18
|
+
return text_field(name,:hidden => true)+content_tag(:div, "",:id => "#{name}_sig")+
|
19
|
+
content_tag(:script, "$(document).ready(function() {
|
20
|
+
var x = $('##{name}_sig');
|
21
|
+
x.jSignature();
|
22
|
+
x.change(function(){
|
23
|
+
$('##{@object_name}_#{name}').val(x.jSignature('getData'));
|
24
|
+
});
|
25
|
+
|
26
|
+
});".html_safe)
|
27
|
+
end
|
14
28
|
end
|
15
29
|
end
|