phlexi-form 0.14.3 → 0.14.4

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: 646d0fa05822cf1814bd5b69b124f7f1601996a17033299721e9a18e90fff91a
4
- data.tar.gz: e89da4957a05d123399d716258c6f46750a4e48fede058dad531573806f2c5f7
3
+ metadata.gz: b2b5a56ff16834553f8f99764902656bef82869bedb49ccd2ee62c3f9a2bb074
4
+ data.tar.gz: ad2a47b6317b7f12278e5c74ece5f3056a8f18b458bdc1fd5210f3e8b458d453
5
5
  SHA512:
6
- metadata.gz: 54be074be2f6131b9ab0d1ef85164527db01b4a801a3834d0b8f0862953cda5e3e0cb11a84abffecce191519bb8630b972cc548aff9fc214e4c532ab17e6df6f
7
- data.tar.gz: 0260d7469abaeb372b7d7299e6e0212241560c4683e30d6a7b708fba552f6292ac83eff4063f4a9feb15a646bfca57bc6bd751af183326b7f478610494511862
6
+ metadata.gz: e6c0e4adf1cce96a7d8b744bc1f0e965725aca7f3e9ff35aabecb0984a8dfe12e829eee7407d6204c46c9e2bc9465b1b97e42b1b0ac5a416ba4a3fb6bc7d81a7
7
+ data.tar.gz: 17435e4ed5c77af281100a14d54082787a32c33059b4d588d086b022cfd042abf1c8d9158e78a2490bb08385592005d6d16a73f2801a8664bf02b22e0e9e1b2d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.14.4]
4
+
5
+ - A field's full error now names the attribute by the field's own label when it
6
+ is given one (`field(:oidc_issuer, label: "Issuer URL")`), so the message
7
+ under the field matches the label above it. Fields without a label, or with
8
+ `label: false`, keep ActiveModel's `human_attribute_name`. Per-model and
9
+ per-attribute `format` overrides still apply.
10
+ - `input_tag` on a field inferred as `:string` now renders a text input with the
11
+ usual text attributes, instead of falling through to the unhandled-type branch.
12
+ - Fix extracting input from an empty nested collection (`nest_many`), which
13
+ passed `nil` to the block.
14
+
3
15
  ## [0.14.3]
4
16
 
5
17
  - Fix `Checkbox#checked?` so boolean-ish values from JSON/text columns or params
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- phlexi-form (0.6.2)
4
+ phlexi-form (0.14.3)
5
5
  activesupport
6
- phlex (~> 1.11)
7
- phlexi-field
6
+ phlex (~> 2.0)
7
+ phlexi-field (~> 0.2.0)
8
8
  zeitwerk
9
9
 
10
10
  GEM
@@ -27,6 +27,8 @@ GEM
27
27
  erubi (~> 1.11)
28
28
  rails-dom-testing (~> 2.2)
29
29
  rails-html-sanitizer (~> 1.6)
30
+ activemodel (7.2.1)
31
+ activesupport (= 7.2.1)
30
32
  activesupport (7.2.1)
31
33
  base64
32
34
  bigdecimal
@@ -38,8 +40,8 @@ GEM
38
40
  minitest (>= 5.1)
39
41
  securerandom (>= 0.3)
40
42
  tzinfo (~> 2.0, >= 2.0.5)
41
- addressable (2.8.7)
42
- public_suffix (>= 2.0.2, < 7.0)
43
+ addressable (2.9.0)
44
+ public_suffix (>= 2.0.2, < 8.0)
43
45
  ansi (1.5.0)
44
46
  appraisal (2.5.0)
45
47
  bundler
@@ -104,18 +106,18 @@ GEM
104
106
  parser (3.3.5.0)
105
107
  ast (~> 2.4.1)
106
108
  racc
107
- phlex (1.11.0)
108
- phlex-testing-capybara (0.1.0)
109
- capybara (~> 3.38)
110
- phlex (>= 0.5)
111
- phlexi-field (0.0.11)
112
- activesupport
109
+ phlex (2.4.1)
110
+ refract (~> 1.0)
111
+ zeitwerk (~> 2.7)
112
+ phlexi-field (0.2.0)
113
+ activesupport (>= 7.1)
113
114
  fiber-local
114
- phlex (~> 1.11)
115
+ phlex (~> 2.0)
115
116
  zeitwerk
117
+ prism (1.9.0)
116
118
  psych (5.1.2)
117
119
  stringio
118
- public_suffix (6.0.1)
120
+ public_suffix (7.0.5)
119
121
  racc (1.8.1)
120
122
  rack (3.1.7)
121
123
  rack-session (2.0.0)
@@ -144,6 +146,9 @@ GEM
144
146
  rake (13.2.1)
145
147
  rdoc (6.7.0)
146
148
  psych (>= 4.0.0)
149
+ refract (1.1.0)
150
+ prism
151
+ zeitwerk
147
152
  regexp_parser (2.9.2)
148
153
  reline (0.5.10)
149
154
  io-console (~> 0.5)
@@ -187,19 +192,20 @@ GEM
187
192
  webrick (1.8.1)
188
193
  xpath (3.2.0)
189
194
  nokogiri (~> 1.8)
190
- zeitwerk (2.6.18)
195
+ zeitwerk (2.8.3)
191
196
 
192
197
  PLATFORMS
193
198
  arm64-darwin-24
194
199
  x86_64-darwin
195
200
 
196
201
  DEPENDENCIES
202
+ activemodel
197
203
  appraisal
198
204
  bundle-audit
205
+ capybara
199
206
  combustion
200
207
  minitest
201
208
  minitest-reporters
202
- phlex-testing-capybara
203
209
  phlexi-form!
204
210
  rake
205
211
  standard
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- phlexi-form (0.3.1)
4
+ phlexi-form (0.14.3)
5
5
  activesupport
6
- phlex (~> 1.11)
6
+ phlex (~> 2.0)
7
+ phlexi-field (~> 0.2.0)
7
8
  zeitwerk
8
9
 
9
10
  GEM
@@ -91,8 +92,8 @@ GEM
91
92
  rake
92
93
  thor (>= 0.14.0)
93
94
  ast (2.4.2)
94
- base64 (0.2.0)
95
- bigdecimal (3.1.8)
95
+ base64 (0.3.0)
96
+ bigdecimal (4.1.3)
96
97
  builder (3.3.0)
97
98
  bundle-audit (0.1.0)
98
99
  bundler-audit
@@ -112,15 +113,18 @@ GEM
112
113
  activesupport (>= 3.0.0)
113
114
  railties (>= 3.0.0)
114
115
  thor (>= 0.14.6)
115
- concurrent-ruby (1.3.4)
116
- connection_pool (2.4.1)
116
+ concurrent-ruby (1.3.8)
117
+ connection_pool (3.0.2)
117
118
  crass (1.0.6)
118
119
  date (3.3.4)
119
- drb (2.2.1)
120
+ drb (2.2.3)
120
121
  erubi (1.13.0)
122
+ fiber-local (1.1.0)
123
+ fiber-storage
124
+ fiber-storage (1.0.1)
121
125
  globalid (1.2.1)
122
126
  activesupport (>= 6.1)
123
- i18n (1.14.5)
127
+ i18n (1.15.2)
124
128
  concurrent-ruby (~> 1.0)
125
129
  io-console (0.7.2)
126
130
  irb (1.14.0)
@@ -140,13 +144,15 @@ GEM
140
144
  marcel (1.0.4)
141
145
  matrix (0.4.2)
142
146
  mini_mime (1.1.5)
143
- minitest (5.25.1)
147
+ minitest (6.0.6)
148
+ drb (~> 2.0)
149
+ prism (~> 1.5)
144
150
  minitest-reporters (1.7.1)
145
151
  ansi
146
152
  builder
147
153
  minitest (>= 5.0)
148
154
  ruby-progressbar
149
- mutex_m (0.2.0)
155
+ mutex_m (0.3.0)
150
156
  net-imap (0.4.16)
151
157
  date
152
158
  net-protocol
@@ -157,16 +163,23 @@ GEM
157
163
  net-smtp (0.5.0)
158
164
  net-protocol
159
165
  nio4r (2.7.3)
166
+ nokogiri (1.16.7-arm64-darwin)
167
+ racc (~> 1.4)
160
168
  nokogiri (1.16.7-x86_64-darwin)
161
169
  racc (~> 1.4)
162
170
  parallel (1.26.3)
163
171
  parser (3.3.5.0)
164
172
  ast (~> 2.4.1)
165
173
  racc
166
- phlex (1.11.0)
167
- phlex-testing-capybara (0.1.0)
168
- capybara (~> 3.38)
169
- phlex (>= 0.5)
174
+ phlex (2.4.1)
175
+ refract (~> 1.0)
176
+ zeitwerk (~> 2.7)
177
+ phlexi-field (0.2.0)
178
+ activesupport (>= 7.1)
179
+ fiber-local
180
+ phlex (~> 2.0)
181
+ zeitwerk
182
+ prism (1.9.0)
170
183
  psych (5.1.2)
171
184
  stringio
172
185
  public_suffix (6.0.1)
@@ -212,6 +225,9 @@ GEM
212
225
  rake (13.2.1)
213
226
  rdoc (6.7.0)
214
227
  psych (>= 4.0.0)
228
+ refract (1.1.0)
229
+ prism
230
+ zeitwerk
215
231
  regexp_parser (2.9.2)
216
232
  reline (0.5.10)
217
233
  io-console (~> 0.5)
@@ -233,6 +249,7 @@ GEM
233
249
  rubocop (>= 1.48.1, < 2.0)
234
250
  rubocop-ast (>= 1.31.1, < 2.0)
235
251
  ruby-progressbar (1.13.0)
252
+ sqlite3 (1.7.3-arm64-darwin)
236
253
  sqlite3 (1.7.3-x86_64-darwin)
237
254
  standard (1.40.0)
238
255
  language_server-protocol (~> 3.17.0.2)
@@ -258,18 +275,20 @@ GEM
258
275
  websocket-extensions (0.1.5)
259
276
  xpath (3.2.0)
260
277
  nokogiri (~> 1.8)
261
- zeitwerk (2.6.18)
278
+ zeitwerk (2.8.3)
262
279
 
263
280
  PLATFORMS
281
+ arm64-darwin-24
264
282
  x86_64-darwin
265
283
 
266
284
  DEPENDENCIES
285
+ activemodel
267
286
  appraisal
268
287
  bundle-audit
288
+ capybara
269
289
  combustion
270
290
  minitest
271
291
  minitest-reporters
272
- phlex-testing-capybara
273
292
  phlexi-form!
274
293
  rails (~> 7.1.3, >= 7.1.3.4)
275
294
  rake
@@ -24,6 +24,7 @@ module Phlexi
24
24
 
25
25
  def build_input_attributes
26
26
  attributes.fetch(:type) { attributes[:type] = field.inferred_string_field_type || field.inferred_field_type }
27
+ attributes[:type] = :text if attributes[:type] == :string
27
28
  attributes.fetch(:disabled) { attributes[:disabled] = field.disabled? }
28
29
 
29
30
  case attributes[:type]
@@ -76,7 +76,7 @@ module Phlexi
76
76
  end
77
77
 
78
78
  def full_errors_on_attribute
79
- object.errors.full_messages_for(key)
79
+ full_messages_for(key)
80
80
  end
81
81
 
82
82
  def errors_on_association
@@ -84,7 +84,39 @@ module Phlexi
84
84
  end
85
85
 
86
86
  def full_errors_on_association
87
- association_reflection ? object.errors.full_messages_for(association_reflection.name) : []
87
+ association_reflection ? full_messages_for(association_reflection.name) : []
88
+ end
89
+
90
+ # ActiveModel names the attribute with human_attribute_name. A field
91
+ # given its own label names it as the form shows it, so the message
92
+ # under the field matches the label above it.
93
+ def full_messages_for(attribute)
94
+ return object.errors.full_messages_for(attribute) unless custom_label?
95
+
96
+ format, *defaults = full_message_formats(attribute)
97
+ object.errors.messages_for(attribute).map do |message|
98
+ I18n.t(format, default: defaults, attribute: label, message: message)
99
+ end
100
+ end
101
+
102
+ # The format keys ActiveModel::Error.full_message looks up, so per-model
103
+ # and per-attribute formats still apply when the label is swapped in.
104
+ def full_message_formats(attribute)
105
+ formats = []
106
+ if ActiveModel::Error.i18n_customize_full_message && object.class.respond_to?(:i18n_scope)
107
+ scope = "#{object.class.i18n_scope}.errors.models"
108
+ formats = object.class.lookup_ancestors.flat_map do |klass|
109
+ [
110
+ :"#{scope}.#{klass.model_name.i18n_key}.attributes.#{attribute}.format",
111
+ :"#{scope}.#{klass.model_name.i18n_key}.format"
112
+ ]
113
+ end
114
+ end
115
+ formats + [:"errors.format", "%{attribute} %{message}"]
116
+ end
117
+
118
+ def custom_label?
119
+ label.present? && label != calculate_label
88
120
  end
89
121
 
90
122
  def has_custom_error?
@@ -9,7 +9,7 @@ module Phlexi
9
9
  def extract_input(params)
10
10
  namespace = namespaces[0]
11
11
  unless namespace
12
- build_namespace(0)
12
+ namespace = build_namespace(0)
13
13
  @block.call(namespace)
14
14
  end
15
15
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlexi
4
4
  module Form
5
- VERSION = "0.14.3"
5
+ VERSION = "0.14.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlexi-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-08 00:00:00.000000000 Z
11
+ date: 2026-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: activemodel
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: standard
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +179,7 @@ dependencies:
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: phlex-testing-capybara
182
+ name: capybara
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="