ele-signature-rails 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ if(!this.JSON){this.JSON={};}
2
+ (function(){function f(n){return n<10?'0'+n:n;}
3
+ if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
4
+ f(this.getUTCMonth()+1)+'-'+
5
+ f(this.getUTCDate())+'T'+
6
+ f(this.getUTCHours())+':'+
7
+ f(this.getUTCMinutes())+':'+
8
+ f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
9
+ var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
10
+ function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
11
+ if(typeof rep==='function'){value=rep.call(holder,key,value);}
12
+ switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
13
+ gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
14
+ v=partial.length===0?'[]':gap?'[\n'+gap+
15
+ partial.join(',\n'+gap)+'\n'+
16
+ mind+']':'['+partial.join(',')+']';gap=mind;return v;}
17
+ if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
18
+ v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
19
+ mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
20
+ if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
21
+ rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
22
+ return str('',{'':value});};}
23
+ if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
24
+ return reviver.call(holder,key,value);}
25
+ cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
26
+ ('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
27
+ if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
28
+ throw new SyntaxError('JSON.parse');};}}());
@@ -0,0 +1,3 @@
1
+ //= require 'signature-pad/jquery.signaturepad'
2
+ //= require 'signature-pad/flashcanvas'
3
+ //= require 'signature-pad/json2.min'
@@ -0,0 +1,210 @@
1
+ @font-face {
2
+ font-family: 'Journal';
3
+ src: url("<%= asset_path 'signature-pad/journal.eot' %>");
4
+ src: url("<%= asset_path 'signature-pad/journal.eot?#iefix' %>") format('embedded-opentype'),
5
+ url("<%= asset_path 'signature-pad/journal.woff' %>") format('woff'),
6
+ url("<%= asset_path 'signature-pad/journal.ttf' %>") format('truetype'),
7
+ url("<%= asset_path 'signature-pad/journal.svg#JournalRegular' %>") format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ .sigPad {
13
+ margin: 0;
14
+ padding: 0;
15
+ width: 200px;
16
+ }
17
+
18
+ .sigPad label {
19
+ display: block;
20
+ margin: 0 0 0.515em;
21
+ padding: 0;
22
+
23
+ color: #000;
24
+ font: italic normal 1em/1.375 Georgia,Times,serif;
25
+ }
26
+
27
+ .sigPad label.error {
28
+ color: #f33;
29
+ }
30
+
31
+ .sigPad input {
32
+ margin: 0;
33
+ padding: 0.2em 0;
34
+ width: 198px;
35
+
36
+ border: 1px solid #666;
37
+
38
+ font-size: 1em;
39
+ }
40
+
41
+ .sigPad input.error {
42
+ border-color: #f33;
43
+ }
44
+
45
+ .sigPad button {
46
+ margin: 1em 0 0 0;
47
+ padding: 0.6em 0.6em 0.7em;
48
+
49
+ background-color: #ccc;
50
+ border: 0;
51
+ -moz-border-radius: 8px;
52
+ -webkit-border-radius: 8px;
53
+ border-radius: 8px;
54
+
55
+ cursor: pointer;
56
+
57
+ color: #555;
58
+ font: bold 1em/1.375 sans-serif;
59
+ text-align: left;
60
+ }
61
+
62
+ .sigPad button:hover {
63
+ background-color: #333;
64
+
65
+ color: #fff;
66
+ }
67
+
68
+ .sig {
69
+ display: none;
70
+ }
71
+
72
+ .sigNav {
73
+ display: none;
74
+ height: 2.25em;
75
+ margin: 0;
76
+ padding: 0;
77
+ position: relative;
78
+
79
+ list-style-type: none;
80
+ }
81
+
82
+ .sigNav li {
83
+ display: inline;
84
+ float: left;
85
+ margin: 0;
86
+ padding: 0;
87
+ }
88
+
89
+ .sigNav a,
90
+ .sigNav a:link,
91
+ .sigNav a:visited {
92
+ display: block;
93
+ margin: 0;
94
+ padding: 0 0.6em;
95
+
96
+ border: 0;
97
+
98
+ color: #333;
99
+ font-weight: bold;
100
+ line-height: 2.25em;
101
+ text-decoration: underline;
102
+ }
103
+
104
+ .sigNav a.current,
105
+ .sigNav a.current:link,
106
+ .sigNav a.current:visited {
107
+ background-color: #666;
108
+ -moz-border-radius-topleft: 8px;
109
+ -moz-border-radius-topright: 8px;
110
+ -webkit-border-top-left-radius: 8px;
111
+ -webkit-border-top-right-radius: 8px;
112
+ border-radius: 8px 8px 0 0;
113
+
114
+ color: #fff;
115
+ text-decoration: none;
116
+ }
117
+
118
+ .sigNav .typeIt a.current,
119
+ .sigNav .typeIt a.current:link,
120
+ .sigNav .typeIt a.current:visited {
121
+ background-color: #ccc;
122
+
123
+ color: #555;
124
+ }
125
+
126
+ .sigNav .clearButton {
127
+ bottom: 0.2em;
128
+ display: none;
129
+ position: absolute;
130
+ right: 0;
131
+
132
+ font-size: 0.75em;
133
+ line-height: 1.375;
134
+ }
135
+
136
+ .sigWrapper {
137
+ clear: both;
138
+ height: 55px;
139
+
140
+ border: 1px solid #ccc;
141
+ }
142
+
143
+ .sigWrapper.current {
144
+ border-color: #666;
145
+ }
146
+
147
+ .signed .sigWrapper {
148
+ border: 0;
149
+ }
150
+
151
+ .pad {
152
+ position: relative;
153
+
154
+ /**
155
+ * For cross browser compatibility, this should be an absolute URL
156
+ * In IE the cursor is relative to the HTML document
157
+ * In all other browsers the cursor is relative to the CSS file
158
+ *
159
+ * http://www.useragentman.com/blog/2011/12/21/cross-browser-css-cursor-images-in-depth/
160
+ */
161
+ cursor: url("../assets/signature-pad/pen.cur"), crosshair;
162
+ /**
163
+ * IE will ignore this line because of the hotspot position
164
+ * Unfortunately we need this twice, because some browsers ignore the hotspot inside the .cur
165
+ */
166
+ cursor: url(<%= asset_path 'signature-pad/pen.cur' %>) 16 16, crosshair;
167
+
168
+ -ms-touch-action: none;
169
+ -webkit-user-select: none;
170
+ -moz-user-select: none;
171
+ -ms-user-select: none;
172
+ -o-user-select: none;
173
+ user-select: none;
174
+ }
175
+
176
+ .typed {
177
+ height: 55px;
178
+ margin: 0;
179
+ padding: 0 5px;
180
+ position: absolute;
181
+ z-index: 90;
182
+
183
+ cursor: default;
184
+
185
+ color: #145394;
186
+ font: normal 1.875em/50px "Journal",Georgia,Times,serif;
187
+ }
188
+
189
+ .typeItDesc,
190
+ .drawItDesc {
191
+ display: none;
192
+ margin: 0.75em 0 0.515em;
193
+ padding: 0.515em 0 0;
194
+
195
+ border-top: 3px solid #ccc;
196
+
197
+ color: #000;
198
+ font: italic normal 1em/1.375 Georgia,Times,serif;
199
+ }
200
+
201
+ p.error {
202
+ display: block;
203
+ margin: 0.5em 0;
204
+ padding: 0.4em;
205
+
206
+ background-color: #f33;
207
+
208
+ color: #fff;
209
+ font-weight: bold;
210
+ }
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require 'signature-pad/jquery.signaturepad'
3
+ */
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ele/signature/rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,37 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "ele/signature/rails/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ele-signature-rails"
8
+ spec.version = Ele::Signature::Rails::VERSION
9
+ spec.authors = ["wenlingang"]
10
+ spec.email = ["gang@tanmer.com"]
11
+
12
+ spec.summary = %q{rails electronic signature}
13
+ spec.description = %q{结合 sinature-js 实现 rails 版本的电子签名}
14
+ spec.homepage = "https://github.com/wenlingang/ele-signature-rails"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_dependency "rails", ">= 3.0.0", "< 5.3"
36
+ spec.add_dependency "jquery-rails", ">= 2.0.1"
37
+ end
@@ -0,0 +1,7 @@
1
+ module Ele
2
+ module Signature
3
+ module Rails
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ require "ele/signature/rails/version"
2
+
3
+ module Ele
4
+ module Signature
5
+ module Rails
6
+ class Error < StandardError; end
7
+ class Engine < ::Rails::Engine
8
+
9
+ initializer 'ele-signature-rails.assets' do |app|
10
+ app.config.assets.precompile += %w( signature-pad/flashcanvas.swf )
11
+ end
12
+
13
+ end
14
+ end
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ele-signature-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - wenlingang
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-08-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.3'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.3'
33
+ - !ruby/object:Gem::Dependency
34
+ name: jquery-rails
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 2.0.1
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.1
47
+ description: 结合 sinature-js 实现 rails 版本的电子签名
48
+ email:
49
+ - gang@tanmer.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - ".gitignore"
55
+ - CODE_OF_CONDUCT.md
56
+ - Gemfile
57
+ - Gemfile.lock
58
+ - LICENSE.txt
59
+ - README.md
60
+ - Rakefile
61
+ - app/assets/cursors/signature-pad/pen.cur
62
+ - app/assets/flash/signature-pad/flashcanvas.swf
63
+ - app/assets/fonts/signature-pad/journal.eot
64
+ - app/assets/fonts/signature-pad/journal.svg
65
+ - app/assets/fonts/signature-pad/journal.ttf
66
+ - app/assets/fonts/signature-pad/journal.woff
67
+ - app/assets/javascripts/signature-pad.js
68
+ - app/assets/javascripts/signature-pad/flashcanvas.js
69
+ - app/assets/javascripts/signature-pad/jquery.signaturepad.js
70
+ - app/assets/javascripts/signature-pad/json2.min.js
71
+ - app/assets/stylesheets/signature-pad.css
72
+ - app/assets/stylesheets/signature-pad/jquery.signaturepad.css.erb
73
+ - bin/console
74
+ - bin/setup
75
+ - ele-signature-rails.gemspec
76
+ - lib/ele/signature/rails.rb
77
+ - lib/ele/signature/rails/version.rb
78
+ homepage: https://github.com/wenlingang/ele-signature-rails
79
+ licenses:
80
+ - MIT
81
+ metadata:
82
+ homepage_uri: https://github.com/wenlingang/ele-signature-rails
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.7.8
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: rails electronic signature
103
+ test_files: []