chobble-forms 0.7.0 → 0.7.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
2
  SHA256:
3
- metadata.gz: 114cd63966175b3b8f30be99441ff3da688526f9e46bc0b08c9add531c93d8eb
4
- data.tar.gz: 225988209e98465f4c92d14729ad9650878519d1563cea5486f90b3342d8a28e
3
+ metadata.gz: 771171d582d4bdb09d03fc7ac56a37ca4922d7ce9ee76f392c19c0667e2cd6d3
4
+ data.tar.gz: e692e2d66579f14eae1099989efddef5a7358620653ac6ab7daaf3ffab151333
5
5
  SHA512:
6
- metadata.gz: 934333541f43b3fd5f8f0c24468f15a1d755b5567c0c341a856c6fedb67932f2a606d93452741ca26531a107d30cbd21363f1ec27f4acc7059a001edc3ca42ac
7
- data.tar.gz: 535ab94d5f12ca207fd4c34d198e3938161465112819c0df18ea8cfa7c8f33ab29d8f44e9112aab6a011bf1889e49cf99e527223dadcdcb920f41830dbea7065
6
+ metadata.gz: c7b53bd70bfa1063f24071b476a9789b43d79c0c539e033857b1331caf0456bb324fea113a93471bc0fef9b114c9b9004f52b10c0c3a82ef52c6a85e54b91e34
7
+ data.tar.gz: f4b9fd0dedb8a2e0d133cf09f0dc0ab5e9e4b390cfeafe510b16424e9ec1037492fdec506db580447c61d6857597bb164d60c2b211fc019f1df58d1472f27202
@@ -135,8 +135,9 @@ module ChobbleForms
135
135
  def build_field_translations(field)
136
136
  i18n_base = T.unsafe(instance_variable_get(:@_current_i18n_base))
137
137
 
138
- field_without_suffix = FieldUtils.strip_field_suffix(field)
139
- fields_key = "#{i18n_base}.fields.#{field_without_suffix}"
138
+ # Only strip _pass suffix for pass/fail fields, not _comment fields
139
+ lookup_field = field.to_s.end_with?("_pass") ? FieldUtils.strip_field_suffix(field) : field
140
+ fields_key = "#{i18n_base}.fields.#{lookup_field}"
140
141
  field_label = t(fields_key, raise: true)
141
142
 
142
143
  base_parts = i18n_base.split(".")
@@ -173,7 +174,15 @@ module ChobbleForms
173
174
 
174
175
  return {value: nil, prefilled: false} if field_str.include?("password")
175
176
 
176
- current_value = model.send(field) if model.respond_to?(field)
177
+ # For composite partials, we receive the base field but need to check for suffixed fields
178
+ # Check for _pass field first (in case both base and _pass exist)
179
+ if model.respond_to?("#{field}_pass")
180
+ current_value = model.send("#{field}_pass")
181
+ elsif model.respond_to?(field)
182
+ current_value = model.send(field)
183
+ else
184
+ raise "Field '#{field}' or '#{field}_pass' not found on #{model.class.name}. Available fields: #{model.attributes.keys.sort.join(", ")}"
185
+ end
177
186
 
178
187
  # Check if this field should not be prefilled based on excluded fields list
179
188
  excluded_fields = T.unsafe(instance_variable_get(:@_excluded_prefill_fields))
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ChobbleForms
5
- VERSION = "0.7.0"
5
+ VERSION = "0.7.1"
6
6
  end
@@ -1,13 +1,14 @@
1
1
  <%
2
2
  # Composite partial for pass/fail + comment fields with grid layout
3
3
  # Required parameters:
4
- # field: Base field name (e.g., 'seam_integrity_pass')
4
+ # field: Base field name (e.g., 'seam_integrity')
5
5
  #
6
6
  # This will render:
7
- # - Pass/fail field: field (e.g., 'seam_integrity_pass')
7
+ # - Pass/fail field: base field + '_pass' (e.g., 'seam_integrity_pass')
8
8
  # - Comment field: base field + '_comment' (e.g., 'seam_integrity_comment')
9
9
 
10
10
  base_field = field.to_s.gsub(/_pass$/, "")
11
+ pass_field = "#{base_field}_pass".to_sym
11
12
  comment_field = "#{base_field}_comment".to_sym
12
13
 
13
14
  form = @_current_form
@@ -30,7 +31,7 @@
30
31
  </label>
31
32
 
32
33
  <%= render 'chobble_forms/radio_pass_fail',
33
- field: field,
34
+ field: pass_field,
34
35
  prefilled: field_data[:prefilled],
35
36
  checked_value: checked_value %>
36
37
 
@@ -1,15 +1,16 @@
1
1
  <%
2
2
  # Composite partial for pass/fail + N/A + comment fields with grid layout
3
3
  # Required parameters:
4
- # field: Base field name (e.g., 'seam_integrity_pass')
4
+ # field: Base field name (e.g., 'seam_integrity')
5
5
  #
6
6
  # This will render:
7
- # - Pass/fail/N/A field: field (e.g., 'seam_integrity_pass')
7
+ # - Pass/fail/N/A field: base field + '_pass' (e.g., 'seam_integrity_pass')
8
8
  # - Enum fields: Pass = "pass", Fail = "fail", N/A = "na" (rendered as radio buttons)
9
9
  # - Boolean fields: Pass = true, Fail = false (rendered as radio buttons)
10
10
  # - Comment field: base field + '_comment' (e.g., 'seam_integrity_comment')
11
11
 
12
12
  base_field = field.to_s.gsub(/_pass$/, "")
13
+ pass_field = "#{base_field}_pass".to_sym
13
14
  comment_field = "#{base_field}_comment".to_sym
14
15
 
15
16
  form = @_current_form
@@ -31,7 +32,7 @@
31
32
  </label>
32
33
 
33
34
  <%= render 'chobble_forms/radio_pass_fail',
34
- field: field,
35
+ field: pass_field,
35
36
  prefilled: field_data[:prefilled],
36
37
  checked_value: checked_value %>
37
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chobble-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chobble.com