prawn-rails-forms 0.1.0 → 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 +4 -4
- data/.rubocop.yml +18 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +146 -0
- data/README.md +7 -0
- data/lib/prawn-rails-forms.rb +8 -110
- data/lib/prawn-rails-forms/document_extensions.rb +79 -0
- data/lib/prawn-rails-forms/field_row.rb +42 -0
- data/lib/prawn-rails-forms/version.rb +3 -1
- data/prawn-rails-forms.gemspec +13 -10
- data/test-app/Gemfile.lock +2 -2
- data/test-app/app/views/pdf/static.pdf.prawn +2 -2
- metadata +21 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16c20f8f7686c055d7ba65f206a774d5d5e4b6f8
|
|
4
|
+
data.tar.gz: f417f0e482894757ab1ff87db27e84b78bb52f4f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6eafaf48b3838eebcdac6399c107d3284b5a269160739cd6788c3e40bf901790852299a2231c4cd2c6f513e95ca0479d061cc19a252b60d92740fe35e9153b2b
|
|
7
|
+
data.tar.gz: fd87878a95697d7e3b97238e1a1b534aa95cb1b441148735f25ad5af04fa50ed9584a179fd836765d19aea0c54aa9d9ba9e445cf9fabfc14b25758c56bea5afe
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 2.4
|
|
3
|
+
Exclude:
|
|
4
|
+
- test-app/**/*
|
|
5
|
+
|
|
6
|
+
# Public docs are sufficient (for now).
|
|
7
|
+
Style/Documentation:
|
|
8
|
+
Enabled: false
|
|
9
|
+
|
|
10
|
+
# This has to match the gem name.
|
|
11
|
+
Style/FileName:
|
|
12
|
+
Exclude:
|
|
13
|
+
- lib/prawn-rails-forms.rb
|
|
14
|
+
|
|
15
|
+
# I don't see the benefit of blacklisting an entire language feature.
|
|
16
|
+
Style/ParallelAssignment:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.1
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
prawn-rails-forms (0.1.0)
|
|
5
|
+
prawn-rails (~> 1.0)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
actioncable (5.1.3)
|
|
11
|
+
actionpack (= 5.1.3)
|
|
12
|
+
nio4r (~> 2.0)
|
|
13
|
+
websocket-driver (~> 0.6.1)
|
|
14
|
+
actionmailer (5.1.3)
|
|
15
|
+
actionpack (= 5.1.3)
|
|
16
|
+
actionview (= 5.1.3)
|
|
17
|
+
activejob (= 5.1.3)
|
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
|
19
|
+
rails-dom-testing (~> 2.0)
|
|
20
|
+
actionpack (5.1.3)
|
|
21
|
+
actionview (= 5.1.3)
|
|
22
|
+
activesupport (= 5.1.3)
|
|
23
|
+
rack (~> 2.0)
|
|
24
|
+
rack-test (~> 0.6.3)
|
|
25
|
+
rails-dom-testing (~> 2.0)
|
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
27
|
+
actionview (5.1.3)
|
|
28
|
+
activesupport (= 5.1.3)
|
|
29
|
+
builder (~> 3.1)
|
|
30
|
+
erubi (~> 1.4)
|
|
31
|
+
rails-dom-testing (~> 2.0)
|
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
33
|
+
activejob (5.1.3)
|
|
34
|
+
activesupport (= 5.1.3)
|
|
35
|
+
globalid (>= 0.3.6)
|
|
36
|
+
activemodel (5.1.3)
|
|
37
|
+
activesupport (= 5.1.3)
|
|
38
|
+
activerecord (5.1.3)
|
|
39
|
+
activemodel (= 5.1.3)
|
|
40
|
+
activesupport (= 5.1.3)
|
|
41
|
+
arel (~> 8.0)
|
|
42
|
+
activesupport (5.1.3)
|
|
43
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
44
|
+
i18n (~> 0.7)
|
|
45
|
+
minitest (~> 5.1)
|
|
46
|
+
tzinfo (~> 1.1)
|
|
47
|
+
arel (8.0.0)
|
|
48
|
+
ast (2.3.0)
|
|
49
|
+
builder (3.2.3)
|
|
50
|
+
concurrent-ruby (1.0.5)
|
|
51
|
+
erubi (1.6.1)
|
|
52
|
+
globalid (0.4.0)
|
|
53
|
+
activesupport (>= 4.2.0)
|
|
54
|
+
i18n (0.8.6)
|
|
55
|
+
loofah (2.0.3)
|
|
56
|
+
nokogiri (>= 1.5.9)
|
|
57
|
+
mail (2.6.6)
|
|
58
|
+
mime-types (>= 1.16, < 4)
|
|
59
|
+
method_source (0.8.2)
|
|
60
|
+
mime-types (3.1)
|
|
61
|
+
mime-types-data (~> 3.2015)
|
|
62
|
+
mime-types-data (3.2016.0521)
|
|
63
|
+
mini_portile2 (2.2.0)
|
|
64
|
+
minitest (5.10.3)
|
|
65
|
+
nio4r (2.1.0)
|
|
66
|
+
nokogiri (1.8.0)
|
|
67
|
+
mini_portile2 (~> 2.2.0)
|
|
68
|
+
parallel (1.12.0)
|
|
69
|
+
parser (2.4.0.2)
|
|
70
|
+
ast (~> 2.3)
|
|
71
|
+
pdf-core (0.7.0)
|
|
72
|
+
powerpack (0.1.1)
|
|
73
|
+
prawn (2.2.2)
|
|
74
|
+
pdf-core (~> 0.7.0)
|
|
75
|
+
ttfunk (~> 1.5)
|
|
76
|
+
prawn-rails (1.0.1)
|
|
77
|
+
prawn
|
|
78
|
+
prawn-table
|
|
79
|
+
rails (>= 3.1.0)
|
|
80
|
+
prawn-table (0.2.2)
|
|
81
|
+
prawn (>= 1.3.0, < 3.0.0)
|
|
82
|
+
rack (2.0.3)
|
|
83
|
+
rack-test (0.6.3)
|
|
84
|
+
rack (>= 1.0)
|
|
85
|
+
rails (5.1.3)
|
|
86
|
+
actioncable (= 5.1.3)
|
|
87
|
+
actionmailer (= 5.1.3)
|
|
88
|
+
actionpack (= 5.1.3)
|
|
89
|
+
actionview (= 5.1.3)
|
|
90
|
+
activejob (= 5.1.3)
|
|
91
|
+
activemodel (= 5.1.3)
|
|
92
|
+
activerecord (= 5.1.3)
|
|
93
|
+
activesupport (= 5.1.3)
|
|
94
|
+
bundler (>= 1.3.0)
|
|
95
|
+
railties (= 5.1.3)
|
|
96
|
+
sprockets-rails (>= 2.0.0)
|
|
97
|
+
rails-dom-testing (2.0.3)
|
|
98
|
+
activesupport (>= 4.2.0)
|
|
99
|
+
nokogiri (>= 1.6)
|
|
100
|
+
rails-html-sanitizer (1.0.3)
|
|
101
|
+
loofah (~> 2.0)
|
|
102
|
+
railties (5.1.3)
|
|
103
|
+
actionpack (= 5.1.3)
|
|
104
|
+
activesupport (= 5.1.3)
|
|
105
|
+
method_source
|
|
106
|
+
rake (>= 0.8.7)
|
|
107
|
+
thor (>= 0.18.1, < 2.0)
|
|
108
|
+
rainbow (2.2.2)
|
|
109
|
+
rake
|
|
110
|
+
rake (10.5.0)
|
|
111
|
+
rubocop (0.51.0)
|
|
112
|
+
parallel (~> 1.10)
|
|
113
|
+
parser (>= 2.3.3.1, < 3.0)
|
|
114
|
+
powerpack (~> 0.1)
|
|
115
|
+
rainbow (>= 2.2.2, < 3.0)
|
|
116
|
+
ruby-progressbar (~> 1.7)
|
|
117
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
118
|
+
ruby-progressbar (1.9.0)
|
|
119
|
+
sprockets (3.7.1)
|
|
120
|
+
concurrent-ruby (~> 1.0)
|
|
121
|
+
rack (> 1, < 3)
|
|
122
|
+
sprockets-rails (3.2.0)
|
|
123
|
+
actionpack (>= 4.0)
|
|
124
|
+
activesupport (>= 4.0)
|
|
125
|
+
sprockets (>= 3.0.0)
|
|
126
|
+
thor (0.19.4)
|
|
127
|
+
thread_safe (0.3.6)
|
|
128
|
+
ttfunk (1.5.1)
|
|
129
|
+
tzinfo (1.2.3)
|
|
130
|
+
thread_safe (~> 0.1)
|
|
131
|
+
unicode-display_width (1.3.0)
|
|
132
|
+
websocket-driver (0.6.5)
|
|
133
|
+
websocket-extensions (>= 0.1.0)
|
|
134
|
+
websocket-extensions (0.1.2)
|
|
135
|
+
|
|
136
|
+
PLATFORMS
|
|
137
|
+
ruby
|
|
138
|
+
|
|
139
|
+
DEPENDENCIES
|
|
140
|
+
bundler (~> 1.15)
|
|
141
|
+
prawn-rails-forms!
|
|
142
|
+
rake (~> 10.0)
|
|
143
|
+
rubocop (~> 0.49)
|
|
144
|
+
|
|
145
|
+
BUNDLED WITH
|
|
146
|
+
1.16.0.pre.2
|
data/README.md
CHANGED
|
@@ -125,6 +125,13 @@ row.text_field field: 'Favorite fruit', value: @user.favorite_fruit,
|
|
|
125
125
|
options: { valign: :center }
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
You can also change the font style.
|
|
129
|
+
|
|
130
|
+
```ruby
|
|
131
|
+
row.text_field field: 'Favorite fruit', value: @user.favorite_fruit,
|
|
132
|
+
options: { style: :italic }
|
|
133
|
+
```
|
|
134
|
+
|
|
128
135
|
And of course, you can combine any or all of the above:
|
|
129
136
|
|
|
130
137
|
```ruby
|
data/lib/prawn-rails-forms.rb
CHANGED
|
@@ -1,117 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'prawn-rails-forms/document_extensions'
|
|
4
|
+
require 'prawn-rails-forms/field_row'
|
|
1
5
|
require 'prawn-rails-forms/version'
|
|
2
6
|
require 'prawn-rails'
|
|
3
7
|
|
|
4
8
|
module PrawnRailsForms
|
|
5
|
-
|
|
6
|
-
attr_accessor :document, :height, :units, :x, :y, :unit_width
|
|
7
|
-
|
|
8
|
-
def initialize(document,height, units, x, y, unit_width)
|
|
9
|
-
@document, @height, @units, @x, @y, @unit_width =
|
|
10
|
-
document, height, units, x, y, unit_width
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def at_height(height, options = {}, &block)
|
|
14
|
-
@y -= height
|
|
15
|
-
if options[:unit].present?
|
|
16
|
-
@x = options[:unit] * @unit_width
|
|
17
|
-
end
|
|
18
|
-
block.call
|
|
19
|
-
@y += height
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def text_field(**args)
|
|
23
|
-
start, width, height = field_attributes args
|
|
24
|
-
@document.send :make_text_field, start, width, height, **args.except(:width, :height)
|
|
25
|
-
@x += width
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def check_box_field(**args)
|
|
29
|
-
start, width, height = field_attributes args
|
|
30
|
-
@document.send :make_check_box_field, start, width, height, **args.except(:width, :height)
|
|
31
|
-
@x += width
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def field_attributes(args)
|
|
37
|
-
start = [@x, @y]
|
|
38
|
-
width = @unit_width * (args[:width] || 1)
|
|
39
|
-
height = args[:height] || @height
|
|
40
|
-
[start, width, height]
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
class PrawnRails::Document
|
|
45
|
-
|
|
46
|
-
def field_row(height:, units:, &block)
|
|
47
|
-
unit_width = bounds.width / units
|
|
48
|
-
yield FieldRow.new(self, height, units, 0, cursor, unit_width)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
private
|
|
52
|
-
|
|
53
|
-
def make_text_field(start, width, height, field:, value:, options: {})
|
|
54
|
-
bounding_box start, width: width, height: height do
|
|
55
|
-
stroke_bounds
|
|
56
|
-
bounds.add_left_padding 2
|
|
57
|
-
move_down 2
|
|
58
|
-
text field.upcase, size: 6
|
|
59
|
-
text_size = options[:size] || 10
|
|
60
|
-
if value.present?
|
|
61
|
-
unless options[:if] == false || options[:unless] == true
|
|
62
|
-
align = options[:align] || :center
|
|
63
|
-
valign = options[:valign] || :bottom
|
|
64
|
-
value = value.to_s unless value.is_a? Array
|
|
65
|
-
text = if value.is_a? Array
|
|
66
|
-
value.join "\n"
|
|
67
|
-
else value.to_s
|
|
68
|
-
end
|
|
69
|
-
# cursor is current y position
|
|
70
|
-
bounding_box [0, cursor], width: bounds.width do
|
|
71
|
-
text_box text, align: align, size: text_size, valign: valign,
|
|
72
|
-
overflow: :ellipses
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def make_check_box_field(start, width, height, field:, options:, checked:, per_column: 3)
|
|
80
|
-
bounding_box start, width: width, height: height do
|
|
81
|
-
stroke_bounds
|
|
82
|
-
bounds.add_left_padding 2
|
|
83
|
-
move_down 2
|
|
84
|
-
text field.upcase, size: 6
|
|
85
|
-
move_down 2
|
|
86
|
-
box_height = cursor
|
|
87
|
-
box_width = (width - 4) / options.each_slice(per_column).count
|
|
88
|
-
options.each_slice(per_column).with_index do |opts, i|
|
|
89
|
-
bounding_box [box_width * i, box_height], width: box_width, height: box_height do
|
|
90
|
-
bounds.add_left_padding 2
|
|
91
|
-
bounds.add_right_padding 2
|
|
92
|
-
move_down 2
|
|
93
|
-
opts.each.with_index do |opt, j|
|
|
94
|
-
overall_index = i * per_column + j
|
|
95
|
-
make_check_box checked: checked[overall_index], text: opt
|
|
96
|
-
move_down 2
|
|
97
|
-
end # each option
|
|
98
|
-
end # options bounding box
|
|
99
|
-
end # each set of options
|
|
100
|
-
end # field bounding box
|
|
101
|
-
end # method definition
|
|
9
|
+
end
|
|
102
10
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
stroke_bounds
|
|
107
|
-
if checked
|
|
108
|
-
move_down 1
|
|
109
|
-
text 'X', align: :center, size: 6, style: :bold
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
bounding_box [9, box_y], width: bounds.width - 9, height: 10 do
|
|
113
|
-
text text, size: 10
|
|
114
|
-
end
|
|
115
|
-
end
|
|
11
|
+
module PrawnRails
|
|
12
|
+
class Document
|
|
13
|
+
include PrawnRailsForms::DocumentExtensions
|
|
116
14
|
end
|
|
117
15
|
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'prawn-rails-forms/field_row'
|
|
4
|
+
|
|
5
|
+
module PrawnRailsForms
|
|
6
|
+
module DocumentExtensions
|
|
7
|
+
def field_row(height:, units:)
|
|
8
|
+
unit_width = bounds.width / units
|
|
9
|
+
yield FieldRow.new(self, height, units, 0, cursor, unit_width)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def make_text_field(start, width, height, field:, value:, options: {})
|
|
15
|
+
bounding_box start, width: width, height: height do
|
|
16
|
+
stroke_bounds
|
|
17
|
+
bounds.add_left_padding 2
|
|
18
|
+
move_down 2
|
|
19
|
+
text field.upcase, size: 6
|
|
20
|
+
text_size = options[:size] || 10
|
|
21
|
+
if value.present?
|
|
22
|
+
unless options[:if] == false || options[:unless] == true
|
|
23
|
+
align = options[:align] || :center
|
|
24
|
+
valign = options[:valign] || :bottom
|
|
25
|
+
style = options[:style]
|
|
26
|
+
value = value.to_s unless value.is_a? Array
|
|
27
|
+
text = if value.is_a? Array
|
|
28
|
+
value.join "\n"
|
|
29
|
+
else value.to_s
|
|
30
|
+
end
|
|
31
|
+
# cursor is current y position
|
|
32
|
+
bounding_box [0, cursor], width: bounds.width do
|
|
33
|
+
text_box text, align: align, size: text_size, valign: valign,
|
|
34
|
+
overflow: :ellipses, style: style
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def make_check_box_field(start, width, height, field:, options:, checked:, per_column: 3)
|
|
42
|
+
bounding_box start, width: width, height: height do
|
|
43
|
+
stroke_bounds
|
|
44
|
+
bounds.add_left_padding 2
|
|
45
|
+
move_down 2
|
|
46
|
+
text field.upcase, size: 6
|
|
47
|
+
move_down 2
|
|
48
|
+
box_height = cursor
|
|
49
|
+
box_width = (width - 4) / options.each_slice(per_column).count
|
|
50
|
+
options.each_slice(per_column).with_index do |opts, i|
|
|
51
|
+
bounding_box [box_width * i, box_height], width: box_width, height: box_height do
|
|
52
|
+
bounds.add_left_padding 2
|
|
53
|
+
bounds.add_right_padding 2
|
|
54
|
+
move_down 2
|
|
55
|
+
opts.each.with_index do |opt, j|
|
|
56
|
+
overall_index = i * per_column + j
|
|
57
|
+
make_check_box checked: checked[overall_index], text: opt
|
|
58
|
+
move_down 2
|
|
59
|
+
end # each option
|
|
60
|
+
end # options bounding box
|
|
61
|
+
end # each set of options
|
|
62
|
+
end # field bounding box
|
|
63
|
+
end # method definition
|
|
64
|
+
|
|
65
|
+
def make_check_box(checked:, text:)
|
|
66
|
+
box_y = cursor
|
|
67
|
+
bounding_box [0, box_y], width: 7, height: 7 do
|
|
68
|
+
stroke_bounds
|
|
69
|
+
if checked
|
|
70
|
+
move_down 1
|
|
71
|
+
text 'X', align: :center, size: 6, style: :bold
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
bounding_box [9, box_y], width: bounds.width - 9, height: 10 do
|
|
75
|
+
text text, size: 10
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PrawnRailsForms
|
|
4
|
+
class FieldRow
|
|
5
|
+
attr_accessor :document, :height, :units, :x, :y, :unit_width
|
|
6
|
+
|
|
7
|
+
def initialize(document, height, units, x, y, unit_width)
|
|
8
|
+
@document, @height, @units, @x, @y, @unit_width =
|
|
9
|
+
document, height, units, x, y, unit_width
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def at_height(height, options = {})
|
|
13
|
+
@y -= height
|
|
14
|
+
@x = options[:unit] * @unit_width if options[:unit].present?
|
|
15
|
+
yield
|
|
16
|
+
@y += height
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def text_field(**args)
|
|
20
|
+
start, width, height = field_attributes args
|
|
21
|
+
@document.send :make_text_field, start, width, height,
|
|
22
|
+
**args.except(:width, :height)
|
|
23
|
+
@x += width
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def check_box_field(**args)
|
|
27
|
+
start, width, height = field_attributes args
|
|
28
|
+
@document.send :make_check_box_field, start, width, height,
|
|
29
|
+
**args.except(:width, :height)
|
|
30
|
+
@x += width
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def field_attributes(args)
|
|
36
|
+
start = [@x, @y]
|
|
37
|
+
width = @unit_width * (args[:width] || 1)
|
|
38
|
+
height = args[:height] || @height
|
|
39
|
+
[start, width, height]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
data/prawn-rails-forms.gemspec
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require
|
|
5
|
+
require 'prawn-rails-forms/version'
|
|
4
6
|
|
|
5
7
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name =
|
|
8
|
+
spec.name = 'prawn-rails-forms'
|
|
7
9
|
spec.version = PrawnRailsForms::VERSION
|
|
8
|
-
spec.authors = [
|
|
9
|
-
spec.email = [
|
|
10
|
+
spec.authors = ['UMass Transportation Services']
|
|
11
|
+
spec.email = ['transit-it@admin.umass.edu']
|
|
10
12
|
spec.licenses = ['MIT']
|
|
11
13
|
|
|
12
|
-
spec.summary =
|
|
13
|
-
spec.homepage =
|
|
14
|
+
spec.summary = 'An extension to PrawnRails, making form layouts easier.'
|
|
15
|
+
spec.homepage = 'https://github.com/umts/prawn-rails-forms'
|
|
14
16
|
spec.files = `git ls-files -z`.split "\x0"
|
|
15
|
-
spec.require_paths = [
|
|
17
|
+
spec.require_paths = ['lib']
|
|
16
18
|
|
|
17
19
|
spec.add_dependency 'prawn-rails', '~> 1.0'
|
|
18
20
|
|
|
19
|
-
spec.add_development_dependency
|
|
20
|
-
spec.add_development_dependency
|
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
23
|
+
spec.add_development_dependency 'rubocop', '~> 0.49'
|
|
21
24
|
end
|
data/test-app/Gemfile.lock
CHANGED
|
@@ -8,7 +8,7 @@ prawn_document do |pdf|
|
|
|
8
8
|
size: 10, valign: :bottom, align: :center
|
|
9
9
|
end
|
|
10
10
|
pdf.bounding_box [unit_width, y], height: 20, width: unit_width * 2 do
|
|
11
|
-
pdf.text_box 'This should be twice as long as the others',
|
|
11
|
+
pdf.text_box 'This should be twice as long as the others, and bold',
|
|
12
12
|
size: 10, valign: :bottom, align: :center
|
|
13
13
|
end
|
|
14
14
|
pdf.bounding_box [unit_width * 3, y], height: 20, width: unit_width do
|
|
@@ -23,7 +23,7 @@ prawn_document do |pdf|
|
|
|
23
23
|
pdf.field_row height: 30, units: 5 do |row|
|
|
24
24
|
row.text_field field: 'Favorite fruit', value: 'Bananas!'
|
|
25
25
|
row.text_field field: 'Longer bananas?', value: 'Absolutely.',
|
|
26
|
-
width: 2
|
|
26
|
+
width: 2, options: { style: :bold }
|
|
27
27
|
row.text_field field: 'Bigger bananas?', value: 'Yes!',
|
|
28
28
|
options: { size: 14 }
|
|
29
29
|
row.text_field field: 'Smaller bananas?', value: 'If you must',
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: prawn-rails-forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UMass Transportation Services
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-12-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: prawn-rails
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '10.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rubocop
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0.49'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0.49'
|
|
55
69
|
description:
|
|
56
70
|
email:
|
|
57
71
|
- transit-it@admin.umass.edu
|
|
@@ -60,10 +74,15 @@ extensions: []
|
|
|
60
74
|
extra_rdoc_files: []
|
|
61
75
|
files:
|
|
62
76
|
- ".gitignore"
|
|
77
|
+
- ".rubocop.yml"
|
|
78
|
+
- ".ruby-version"
|
|
63
79
|
- Gemfile
|
|
80
|
+
- Gemfile.lock
|
|
64
81
|
- LICENSE
|
|
65
82
|
- README.md
|
|
66
83
|
- lib/prawn-rails-forms.rb
|
|
84
|
+
- lib/prawn-rails-forms/document_extensions.rb
|
|
85
|
+
- lib/prawn-rails-forms/field_row.rb
|
|
67
86
|
- lib/prawn-rails-forms/version.rb
|
|
68
87
|
- prawn-rails-forms.gemspec
|
|
69
88
|
- test-app/Gemfile
|