active_scaffold_signaturepad 0.0.1 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f4e79f674fe254f1706e6aa02c2e850b0752a9d6
4
- data.tar.gz: 157ad8d3523717241b774d62df6eed74cc21902b
2
+ SHA256:
3
+ metadata.gz: 6f03a9df6347ad508446f4bef170e2acee2b7cae1b4d53d4469c33d5826cba62
4
+ data.tar.gz: 686482d4a95dd96487fedb622941cfb3e407b366b25ee3c821ede604b4f1bbae
5
5
  SHA512:
6
- metadata.gz: 5f27772edad9aa856f3733d27f94bae470d5c0369abbbedcad05e69db6ca05e54066543f3a7fd65c646eddcd34f88d888a25e3f9ef9599f63fb75555f9f44147
7
- data.tar.gz: 0cdd63478ce959a0d8c982eba153cff2d59228d1937df4adcd8543a39547177ec2782cd9b0f1fbe750b7e1bcf62a2abd2fefe7efc689fea944f196a4ecd892c6
6
+ metadata.gz: 03e789c264c8112ab0868c12474ba81ee2629daf203c39c3dad193ca7f92c48a5de26fedbdc8cffb1a5a5e81701d4d409617749b60a5c9e72e04a192fd5bb55f
7
+ data.tar.gz: 367787ed2c7241486029088c2da3a261cebef9b654eac69d3d8f0e82ebee2136f7638f8ef6e1124400fddbcf70e578154375fb3c8641e684b91180446bfd15e8
data/README.textile CHANGED
@@ -34,12 +34,18 @@ class VisitorsController < ApplicationController
34
34
  config.columns[:signature].options = {
35
35
  :width => 150, # canvas width, default 250
36
36
  :height => 55, # canvas height, default 100
37
- :lineColour => 'transparent' # colour for signature line on canvas, transparent for none
37
+ :line_colour => 'transparent' # colour for signature line on canvas, transparent for none
38
38
  }
39
39
  end
40
40
  end
41
41
  </pre>
42
42
 
43
+ Available options: line_colour, line_width, line_margin, line_top, bg_colour, pen_colour, pen_width, pen_cap, error_message_draw
44
+
45
+ See "jquery.signaturepad doc":http://thomasjbradley.ca/lab/signature-pad/#options-ref for reference about options
46
+
47
+ If error_message_draw is a symbol it will be translated (using as_ method, so it must be on active_scaffold namespace)
48
+
43
49
  h4. Save image
44
50
 
45
51
  Signaturepad sends a JSON representation to signature. It can be converted to image on server, adding some code to model:
@@ -15,8 +15,9 @@ ActiveScaffold.signaturepad = function(selector_or_elements, parent) {
15
15
  if (val != null) options[opt] = val;
16
16
  });
17
17
  if (!options.displayOnly) options.drawOnly = !$pad.data('type');
18
- var api = $pad.signaturePad(options);
18
+ var signature = $('input', $pad).val(), api = $pad.signaturePad(options);
19
19
  if (options.displayOnly) api.regenerate($pad.data('signature'));
20
+ else if (signature) api.regenerate(signature);
20
21
  });
21
22
  };
22
23
 
@@ -1,7 +1,7 @@
1
1
  module ActiveScaffoldSignaturepad
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
@@ -1,37 +1,38 @@
1
1
  module ActiveScaffoldSignaturepad
2
2
  module ViewHelpers
3
3
  ATTRIBUTES = [:line_colour, :line_width, :line_margin, :line_top, :bg_colour, :pen_colour, :pen_width, :pen_cap, :display_only, :error_message_draw]
4
- def signaturepad_attributes(column)
5
- attributes = ATTRIBUTES.map{ |attr| [attr, column.options[attr]] if column.options[attr] }
4
+ def signaturepad_attributes(column, ui_options: column.options)
5
+ attributes = ATTRIBUTES.map{ |attr| [attr, ui_options[attr]] if ui_options[attr] }
6
6
  attributes = Hash[attributes].reverse_merge(:error_message_draw => :sign_document)
7
- attributes[:type] = column.options[:type] if column.options[:type]
7
+ attributes[:type] = ui_options[:type] if ui_options[:type]
8
8
  attributes[:error_message_draw] = as_(attributes[:error_message_draw]) if attributes[:error_message_draw].is_a? Symbol
9
9
  attributes
10
10
  end
11
11
 
12
- def active_scaffold_input_signaturepad(column, html_options)
13
- content_tag(:div, :class => "sigPad #{html_options[:class]}", :data => signaturepad_attributes(column)) do
14
- content_tag(:ul, :class => 'sigNav') do
15
- if column.options[:type]
16
- content_tag(:li, link_to(as_(:type_it), '#type-it'), :class => 'typeIt') <<
17
- content_tag(:li, link_to(as_(:draw_it), '#draw-it'), :class => 'drawIt')
12
+ def active_scaffold_input_signaturepad(column, html_options, ui_options: column.options)
13
+ content_tag(:div, class: "sigPad #{html_options[:class]}", data: signaturepad_attributes(column, ui_options: ui_options)) do
14
+ content_tag(:ul, class: 'sigNav') do
15
+ if ui_options[:type]
16
+ content_tag(:li, link_to(as_(:type_it), '#type-it'), class: 'typeIt') <<
17
+ content_tag(:li, link_to(as_(:draw_it), '#draw-it'), class: 'drawIt')
18
18
  else
19
19
  ''.html_safe
20
20
  end <<
21
- content_tag(:li, link_to(as_(:clear), '#clear'), :class => 'clearButton')
21
+ content_tag(:li, link_to(as_(:clear), '#clear'), class: 'clearButton')
22
22
  end <<
23
- content_tag(:div, :class => 'sig sigWrapper') do
24
- (column.options[:type] ? content_tag(:div, '', :class => 'typed') : ''.html_safe) <<
25
- content_tag(:canvas, '', :width => column.options[:width] || 250, :height => column.options[:height] || 100) <<
26
- hidden_field(:record, column.name, html_options.merge(:class => 'output'))
23
+ content_tag(:div, class: 'sig sigWrapper') do
24
+ (ui_options[:type] ? content_tag(:div, '', class: 'typed') : ''.html_safe) <<
25
+ content_tag(:canvas, '', width: ui_options[:width] || 250, height: ui_options[:height] || 100) <<
26
+ hidden_field(:record, column.name, html_options.merge(class: 'output'))
27
27
  end
28
28
  end
29
29
  end
30
30
 
31
- def active_scaffold_column_signaturepad(record, column)
32
- content_tag :div, :class => 'sigPad', :data => signaturepad_attributes(column).merge(:display_only => true, :signature => record.send(column.name)) do
33
- content_tag :div, :class => 'sigWrapper' do
34
- content_tag :canvas, '', :width => column.options[:width] || 250, :height => column.options[:height] || 100
31
+ def active_scaffold_column_signaturepad(record, column, ui_options: column.options)
32
+ data = signaturepad_attributes(column, ui_options: ui_options).merge(display_only: true, signature: record.send(column.name))
33
+ content_tag :div, class: 'sigPad', data: data do
34
+ content_tag :div, class: 'sigWrapper' do
35
+ content_tag :canvas, '', width: ui_options[:width] || 250, height: ui_options[:height] || 100
35
36
  end
36
37
  end
37
38
  end
metadata CHANGED
@@ -1,56 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_signaturepad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
8
  - Volker Hochstein
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-15 00:00:00.000000000 Z
12
+ date: 2024-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: shoulda
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - '>='
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - '>='
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: bundler
30
16
  requirement: !ruby/object:Gem::Requirement
31
17
  requirements:
32
- - - ~>
18
+ - - "~>"
33
19
  - !ruby/object:Gem::Version
34
- version: '1.0'
20
+ version: '2.0'
35
21
  type: :development
36
22
  prerelease: false
37
23
  version_requirements: !ruby/object:Gem::Requirement
38
24
  requirements:
39
- - - ~>
25
+ - - "~>"
40
26
  - !ruby/object:Gem::Version
41
- version: '1.0'
27
+ version: '2.0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: active_scaffold
44
30
  requirement: !ruby/object:Gem::Requirement
45
31
  requirements:
46
- - - '>='
32
+ - - ">="
47
33
  - !ruby/object:Gem::Version
48
34
  version: 3.4.0
49
35
  type: :runtime
50
36
  prerelease: false
51
37
  version_requirements: !ruby/object:Gem::Requirement
52
38
  requirements:
53
- - - '>='
39
+ - - ">="
54
40
  - !ruby/object:Gem::Version
55
41
  version: 3.4.0
56
42
  description: Helper to display a signature zone on ActiveScaffold forms, using jquery.signaturepad
@@ -78,24 +64,23 @@ homepage: http://github.com/activescaffold/active_scaffold_signaturepad
78
64
  licenses:
79
65
  - MIT
80
66
  metadata: {}
81
- post_install_message:
67
+ post_install_message:
82
68
  rdoc_options: []
83
69
  require_paths:
84
70
  - lib
85
71
  required_ruby_version: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - '>='
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
75
  version: '0'
90
76
  required_rubygems_version: !ruby/object:Gem::Requirement
91
77
  requirements:
92
- - - '>='
78
+ - - ">="
93
79
  - !ruby/object:Gem::Version
94
80
  version: '0'
95
81
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.4.5
98
- signing_key:
82
+ rubygems_version: 3.2.3
83
+ signing_key:
99
84
  specification_version: 4
100
85
  summary: Signaturepad form_ui using jquery.signaturepad
101
86
  test_files: []