fourmi-prawn-utils 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ea58138a0f9fd6da9db87d1bb929f962d85a9ff3a3a5e6a7f46991e179d401d
4
- data.tar.gz: 3a3402195f5fa623959b51038f03144a94a612a52ef58aa7183206fa44ee1087
3
+ metadata.gz: 0aef32db3f2b740b611ddb336948f421ade7dc5120ef8a24490ab72c242c84ec
4
+ data.tar.gz: b006e05bf10e3c31aa987ea0a252f2df7f855518b4abc31eb9939982fd116174
5
5
  SHA512:
6
- metadata.gz: 48c9de9298d9c4d52dfedf9e187e09c900db0c27120513f475c5cab7c4e624ed1158331f413dae1b3815df9242cf4c353ff25870c274db81193ff85eda0b591b
7
- data.tar.gz: 5ae9ada9f8c253fe376e6bf1622443755e946768afb842e9ee2048f16d36a50fc384339d5139ec4fb72a086e81b2fb4cb2d976fac705f42c09982aee4e403016
6
+ metadata.gz: 30d707fbd18789f1284e6b0773f93a1d83d38198d304c9b9dc1e78bcfe457df0da5b2dbcbddc4140cc8b1e00e577215b5900f6323562d28c4e4fd818217779be
7
+ data.tar.gz: 61dfdc6e75eba72df38f74a6d9818e8d6f7c8c52e2f146a00977d0226264abc9307e7da32e630ca6f5faeb2d646b41f5a38f820346edca0746f850512f7216b4
@@ -4,8 +4,8 @@ require 'prawn/blank'
4
4
  module Fourmi::Prawn::Utils
5
5
  module Extensions
6
6
  module VisualForm
7
- def visual_checkbox(name, checked = false, size: 8, white: false, form: false)
8
- bounding_box([0, cursor], width: bounds.width) do
7
+ def visual_checkbox(name, checked = false, size: 8, white: false, form: false, at: [0, cursor])
8
+ bounding_box(at, width: bounds.width) do
9
9
  float do
10
10
  bounding_box([0, cursor], width: size, height: size) do
11
11
  if form
@@ -24,6 +24,30 @@ module Fourmi::Prawn::Utils
24
24
  end if block_given?
25
25
  end
26
26
  end
27
+
28
+ def visual_radio(parent, value:, checked: false, size: 8, white: false, form: false, at: [0, cursor])
29
+ bounding_box(at, width: bounds.width) do
30
+ float do
31
+ bounding_box([0, cursor], width: size, height: size) do
32
+ center_coordinates = [bounds.right / 2.0, bounds.top / 2.0]
33
+ radius = size / 2.0
34
+
35
+ if form
36
+ radio parent: parent, at: [0, bounds.top], value: value, width: bounds.width, height: bounds.height
37
+ else
38
+ with_fill_color 'FFFFFF' do
39
+ fill_circle center_coordinates, radius if white
40
+ end
41
+ fill_circle center_coordinates, radius - 2 if checked
42
+ end
43
+ stroke_circle center_coordinates, bounds.width / 2
44
+ end
45
+ end
46
+ indent(size + 7) do
47
+ yield
48
+ end if block_given?
49
+ end
50
+ end
27
51
  end
28
52
  end
29
53
  end
@@ -3,7 +3,7 @@
3
3
  module Fourmi
4
4
  module Prawn
5
5
  module Utils
6
- VERSION = "0.1.0"
6
+ VERSION = "0.2.0"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fourmi-prawn-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Dott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-14 00:00:00.000000000 Z
11
+ date: 2025-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prawn
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 3.3.21
84
+ rubygems_version: 3.5.22
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Some methods to simplify PDF creation with Prawn