poetry-simple_form 0.1.3 → 0.1.5
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/CHANGELOG.md +11 -0
- data/lib/generators/poetry/simple_form/install/install_generator.rb +2 -1
- data/lib/poetry/simple_form/inputs/base.rb +1 -0
- data/lib/poetry/simple_form/inputs/boolean_input.rb +1 -0
- data/lib/poetry/simple_form/inputs/collection_inputs.rb +18 -0
- data/lib/poetry/simple_form/inputs/custom_inputs.rb +7 -0
- data/lib/poetry/simple_form/inputs/date_time_input.rb +1 -0
- data/lib/poetry/simple_form/inputs/file_input.rb +1 -0
- data/lib/poetry/simple_form/inputs/numeric_input.rb +1 -0
- data/lib/poetry/simple_form/inputs/password_input.rb +1 -0
- data/lib/poetry/simple_form/inputs/string_input.rb +1 -0
- data/lib/poetry/simple_form/inputs/text_input.rb +1 -0
- data/lib/poetry/simple_form/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ffccc7f78070ec926ea915e06374ac2a02a8fe19a7a7a25827e381e5220534ab
|
|
4
|
+
data.tar.gz: 53529f398491bc327e68792b4abea385174e3a76a50260df679c2f9d56563038
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f102f0337dec1b24ec672b9db9b1868f578d20eecc1780a22d2dbc377e072645e25bc31cce315e4ee4d465a49255f02702104b94eea7b11eb339ef5f35a028d0
|
|
7
|
+
data.tar.gz: 3dc8d52ed76c70af13033e56944f2c9ae06fd90c65a318f85d0c0f27844bfe8119d7d6f93763dfc10e4ccd06f9c72d80174fb845f0eec654597a06c1a2c067bc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.5] - 2026-09-18
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- 1 method the reference already hid with `@api private` is Ruby-private now: each was called only by its own class or template, so the runtime enforces what the tag only stated. A host that reached one gets a NoMethodError instead of an internal that may change without notice. The tag remains on the internals the family shares between its gems and on whole internal classes.
|
|
8
|
+
- Every class, module and method carries a one-sentence description, private helpers included: `rake yard:coverage:all` measures the whole tree (a tag-only docstring counts as blank) and the committed floor now stands at zero.
|
|
9
|
+
|
|
10
|
+
## [0.1.4] - 2026-09-15
|
|
11
|
+
|
|
12
|
+
Lockstep release with the family; no changes in this gem.
|
|
13
|
+
|
|
3
14
|
## [0.1.3] - 2026-09-13
|
|
4
15
|
|
|
5
16
|
Lockstep release with the family; no changes in this gem.
|
|
@@ -14,7 +14,6 @@ module Poetry
|
|
|
14
14
|
source_root File.expand_path("templates", __dir__)
|
|
15
15
|
|
|
16
16
|
# Write config/initializers/poetry_simple_form.rb.
|
|
17
|
-
# @api private
|
|
18
17
|
def create_initializer
|
|
19
18
|
create_file "config/initializers/poetry_simple_form.rb", <<~RUBY_FILE
|
|
20
19
|
# poetry renders simple_form's inputs (the migration bridge):
|
|
@@ -24,6 +23,8 @@ module Poetry
|
|
|
24
23
|
Poetry::SimpleForm.activate!
|
|
25
24
|
RUBY_FILE
|
|
26
25
|
end
|
|
26
|
+
|
|
27
|
+
private :create_initializer
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -24,6 +24,7 @@ module Poetry
|
|
|
24
24
|
# Subclasses answer the poetry `as:` value (nil lets poetry infer).
|
|
25
25
|
def poetry_as = nil
|
|
26
26
|
|
|
27
|
+
# A Poetry form builder over the same object, the one the inputs render through.
|
|
27
28
|
def poetry_builder
|
|
28
29
|
Poetry::Ui::FormBuilder.new(object_name, object, template, {})
|
|
29
30
|
end
|
|
@@ -10,6 +10,8 @@ module Poetry
|
|
|
10
10
|
class CollectionBase < Base
|
|
11
11
|
private
|
|
12
12
|
|
|
13
|
+
# The collection as label and value pairs, reading the configured label
|
|
14
|
+
# and value methods when the items are records.
|
|
13
15
|
def label_value_pairs(collection = Array(options[:collection]))
|
|
14
16
|
return [] if collection.empty?
|
|
15
17
|
|
|
@@ -27,6 +29,7 @@ module Poetry
|
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
|
|
32
|
+
# An item's label or value: a callable is called, a symbol is sent.
|
|
30
33
|
def read(item, method)
|
|
31
34
|
method.respond_to?(:call) ? method.call(item) : item.public_send(method)
|
|
32
35
|
end
|
|
@@ -39,6 +42,7 @@ module Poetry
|
|
|
39
42
|
# Render the collection as a Field-wrapped Select;
|
|
40
43
|
# include_blank/prompt becomes the placeholder option.
|
|
41
44
|
#
|
|
45
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
42
46
|
# @return [String] the rendered Field HTML
|
|
43
47
|
def input(_wrapper_options = nil)
|
|
44
48
|
poetry_builder.poetry_select(attribute_name, label_value_pairs,
|
|
@@ -52,6 +56,7 @@ module Poetry
|
|
|
52
56
|
class CollectionRadioButtonsInput < CollectionBase
|
|
53
57
|
# Render the collection as a Field-wrapped RadioGroup.
|
|
54
58
|
#
|
|
59
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
55
60
|
# @return [String] the rendered Field HTML
|
|
56
61
|
def input(_wrapper_options = nil)
|
|
57
62
|
pairs = label_value_pairs.map { |label, value| [value, label] }
|
|
@@ -64,6 +69,7 @@ module Poetry
|
|
|
64
69
|
class CollectionCheckBoxesInput < CollectionBase
|
|
65
70
|
# Render the collection as a Field-wrapped checkbox group.
|
|
66
71
|
#
|
|
72
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
67
73
|
# @return [String] the rendered Field HTML
|
|
68
74
|
def input(_wrapper_options = nil)
|
|
69
75
|
pairs = label_value_pairs.map { |label, value| [value, label] }
|
|
@@ -74,6 +80,8 @@ module Poetry
|
|
|
74
80
|
# Serves `as: :native_select`: a poetry Field wrapping the styled
|
|
75
81
|
# native <select> (the no-JS picker).
|
|
76
82
|
class NativeSelectInput < CollectionBase
|
|
83
|
+
# Renders the field as a native select.
|
|
84
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
77
85
|
# @return [String] the rendered Field HTML
|
|
78
86
|
def input(_wrapper_options = nil)
|
|
79
87
|
poetry_builder.native_select(attribute_name, label_value_pairs,
|
|
@@ -84,6 +92,8 @@ module Poetry
|
|
|
84
92
|
|
|
85
93
|
# Serves `as: :combobox`: a poetry Field wrapping the filterable Combobox.
|
|
86
94
|
class ComboboxInput < CollectionBase
|
|
95
|
+
# Renders the field as a combobox.
|
|
96
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
87
97
|
# @return [String] the rendered Field HTML
|
|
88
98
|
def input(_wrapper_options = nil)
|
|
89
99
|
poetry_builder.poetry_combobox(attribute_name, label_value_pairs,
|
|
@@ -95,6 +105,8 @@ module Poetry
|
|
|
95
105
|
# Serves `as: :autocomplete`: a poetry Field wrapping the Autocomplete;
|
|
96
106
|
# the collection becomes its suggestions.
|
|
97
107
|
class AutocompleteInput < CollectionBase
|
|
108
|
+
# Renders the field as an autocomplete.
|
|
109
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
98
110
|
# @return [String] the rendered Field HTML
|
|
99
111
|
def input(_wrapper_options = nil)
|
|
100
112
|
poetry_builder.autocomplete(attribute_name, label_value_pairs, **poetry_options)
|
|
@@ -105,6 +117,8 @@ module Poetry
|
|
|
105
117
|
# group_label_method resolve the groups, poetry's Select renders them
|
|
106
118
|
# as labelled groups.
|
|
107
119
|
class GroupedCollectionSelectInput < CollectionBase
|
|
120
|
+
# Renders the field as a select with labelled groups.
|
|
121
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
108
122
|
# @return [String] the rendered Field HTML
|
|
109
123
|
def input(_wrapper_options = nil)
|
|
110
124
|
poetry_builder.poetry_select(attribute_name, grouped_pairs,
|
|
@@ -124,6 +138,7 @@ module Poetry
|
|
|
124
138
|
end
|
|
125
139
|
end
|
|
126
140
|
|
|
141
|
+
# A group's label, through the configured or the first responding label method.
|
|
127
142
|
def group_label_for(group)
|
|
128
143
|
method = options[:group_label_method] ||
|
|
129
144
|
::SimpleForm.collection_label_methods.find { |m| group.respond_to?(m) }
|
|
@@ -135,6 +150,8 @@ module Poetry
|
|
|
135
150
|
# Select, the priority zones (priority: or SimpleForm.time_zone_priority)
|
|
136
151
|
# listed first.
|
|
137
152
|
class TimeZoneInput < CollectionBase
|
|
153
|
+
# Renders the field as a select over the time zones.
|
|
154
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
138
155
|
# @return [String] the rendered Field HTML
|
|
139
156
|
def input(_wrapper_options = nil)
|
|
140
157
|
poetry_builder.poetry_select(attribute_name, zone_pairs,
|
|
@@ -144,6 +161,7 @@ module Poetry
|
|
|
144
161
|
|
|
145
162
|
private
|
|
146
163
|
|
|
164
|
+
# Every time zone as a label and name pair, the priority zones first.
|
|
147
165
|
def zone_pairs
|
|
148
166
|
zones = ActiveSupport::TimeZone.all
|
|
149
167
|
priority = Array(options[:priority] || ::SimpleForm.time_zone_priority)
|
|
@@ -11,6 +11,7 @@ module Poetry
|
|
|
11
11
|
class SwitchInput < Base
|
|
12
12
|
private
|
|
13
13
|
|
|
14
|
+
# Renders as Poetry's switch field.
|
|
14
15
|
def poetry_as = :switch
|
|
15
16
|
end
|
|
16
17
|
|
|
@@ -18,6 +19,7 @@ module Poetry
|
|
|
18
19
|
class SliderInput < Base
|
|
19
20
|
private
|
|
20
21
|
|
|
22
|
+
# Renders as Poetry's slider field.
|
|
21
23
|
def poetry_as = :slider
|
|
22
24
|
end
|
|
23
25
|
|
|
@@ -25,6 +27,7 @@ module Poetry
|
|
|
25
27
|
class OtpInput < Base
|
|
26
28
|
private
|
|
27
29
|
|
|
30
|
+
# Renders as Poetry's one-time-code field.
|
|
28
31
|
def poetry_as = :otp
|
|
29
32
|
end
|
|
30
33
|
|
|
@@ -32,6 +35,7 @@ module Poetry
|
|
|
32
35
|
class SensitiveInput < Base
|
|
33
36
|
private
|
|
34
37
|
|
|
38
|
+
# Renders as Poetry's sensitive field.
|
|
35
39
|
def poetry_as = :sensitive
|
|
36
40
|
end
|
|
37
41
|
|
|
@@ -39,6 +43,7 @@ module Poetry
|
|
|
39
43
|
class TagGroupInput < Base
|
|
40
44
|
private
|
|
41
45
|
|
|
46
|
+
# Renders as Poetry's tag group field.
|
|
42
47
|
def poetry_as = :tag_group
|
|
43
48
|
end
|
|
44
49
|
|
|
@@ -46,6 +51,7 @@ module Poetry
|
|
|
46
51
|
class DatePickerInput < Base
|
|
47
52
|
private
|
|
48
53
|
|
|
54
|
+
# Renders as Poetry's date picker field.
|
|
49
55
|
def poetry_as = :date_picker
|
|
50
56
|
end
|
|
51
57
|
|
|
@@ -53,6 +59,7 @@ module Poetry
|
|
|
53
59
|
class CalendarInput < Base
|
|
54
60
|
private
|
|
55
61
|
|
|
62
|
+
# Renders as Poetry's inline calendar field.
|
|
56
63
|
def poetry_as = :calendar
|
|
57
64
|
end
|
|
58
65
|
end
|
|
@@ -9,6 +9,7 @@ module Poetry
|
|
|
9
9
|
# Render :date/:time/:datetime attributes as poetry DateField /
|
|
10
10
|
# TimeField / DateTimeField - one control each, ISO on the wire.
|
|
11
11
|
#
|
|
12
|
+
# @param _wrapper_options [Hash, nil] Simple Form's wrapper options, unused: the Field is the wrapper
|
|
12
13
|
# @return [String] the rendered HTML
|
|
13
14
|
def input(_wrapper_options = nil)
|
|
14
15
|
Poetry::Ui::FormBuilder.new(object_name, object, template, {})
|
|
@@ -8,6 +8,7 @@ module Poetry
|
|
|
8
8
|
class StringInput < Base
|
|
9
9
|
private
|
|
10
10
|
|
|
11
|
+
# The Poetry field type for a string column, or nil so Poetry infers one for the no-column fallback.
|
|
11
12
|
def poetry_as
|
|
12
13
|
# :string is simple_form's no-column fallback (ActiveModel,
|
|
13
14
|
# virtual attributes) - hand poetry a nil so ITS inference runs
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: poetry-simple_form
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Solt
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.1.
|
|
18
|
+
version: 0.1.5
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.1.
|
|
25
|
+
version: 0.1.5
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: simple_form
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
95
|
version: '0'
|
|
96
96
|
requirements: []
|
|
97
|
-
rubygems_version: 4.0.
|
|
97
|
+
rubygems_version: 4.0.20
|
|
98
98
|
specification_version: 4
|
|
99
99
|
summary: 'The simple_form migration bridge for Poetry: f.input renders Poetry Fields.'
|
|
100
100
|
test_files: []
|