inline_forms 8.1.8 → 8.1.9

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: 6faae45fc3c25f20b57cc614e61e77a5264c1d866a5fde22a6e634c639fb54b9
4
- data.tar.gz: a30324d9cc1f598b4a9c5531f0b4fa45fe47186d2a07b8fc956e38c988a52872
3
+ metadata.gz: bba19f36ffc279e71b2fe0c0fa9a8ec9501424f5fddab372d50941c1e4905dc3
4
+ data.tar.gz: 6a0473bcf4539bddf580dabaae2a5ecfc9decc36c0e691cd63aa79a3127a8478
5
5
  SHA512:
6
- metadata.gz: 9777058054bb9d8e1ff3213e0fd7bf420fd060f69a43005aef71e2fc9088aa58ccfb0e60aaa5ac4d57739aaa555bb01820bb1cc328d31543295ca8377c476eff
7
- data.tar.gz: 3f938ebcb879f72cecd60bd0c2e8eab47c1d01c410c7e32c137953e8f925cda614ce1b32e418bd887d0c833aaeecb0909fb9ba73c75911742473b22cfc9e186c
6
+ metadata.gz: 4f33889510601ad516280f0727f73a2e33a023d82cae3bf0bf28f46747ecb3e0a53f4b89554b5c016fd04657ecab69bdf171091e252e2efd3abaaa274166f4fe
7
+ data.tar.gz: 3c452681ce7d64bcf4d5716e1e41c2ad4d9d830e6a68cdd2a294d256b20308703d73811ef514f7940b634794cf4521dd18cdd4ee9e8e9e68613692129ca0691b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [8.1.9] - 2026-05-27
8
+
9
+ ### Fixed
10
+
11
+ - **`dropdown_with_values_show` and `dropdown_with_values_info` double-translated their labels.** `attribute_values` already runs each label through `t()` (it has to, so the values hash can use translation keys). The two show/info helpers then ran `t()` again on the *already-translated* string, so a missing translation rendered a bizarre `<span class="translation_missing" title="Low&quot;&gt;Low&lt;/Span&gt;">Low"&gt;Low&lt;/Span&gt;</span>` blob inside the inline-edit link (visible on `priority` / `priority2` in the showcase). The second `t()` call has been removed and the helpers now nil-guard the lookup, matching the 8.1.7 fixes to `dropdown_with_integers_show` and the two scale helpers.
12
+ - **`money_field_show` dropped cents on whole-dollar amounts.** money-rails defaults `humanized_money_with_symbol` to `no_cents_if_whole: true`, so `Money.from_amount(124.00, "USD")` rendered as `$124` while `Money.from_amount(12.34, "USD")` rendered as `$12.34` — inconsistent, and indistinguishable from a precision bug on values that *rounded* to a whole dollar (e.g. `Money.from_amount(123.999, "USD")` rounds up to 12400 cents because cents are the smallest Money unit; the helper now shows that as `$124.00`). The helper now passes `no_cents_if_whole: false` so the displayed amount always has two decimals.
13
+
14
+ ### Changed
15
+
16
+ - **`FormElementShowcase` now demos `[:locales, :check_list]` + `[:locales_display, :info_list]` instead of `[:roles, :info_list]`.** Role is reserved for the auth Member/User model — reusing it on the showcase coincidentally shared rows with `roles_users` and obscured how the demo associations were coupled. The example app now seeds four locales (`en`/`nl`/`de`/`fr`, English is the default attached to the full demo) and a `has_and_belongs_to_many :locales` join, so the showcase exercises the editable HABTM editor (`check_list`) and the read-only mirror (`info_list`) side-by-side. The read-only row uses `alias_method :locales_display, :locales` because inline_forms keys turbo frames by attribute name, so two rows for the same association need two distinct names.
17
+ - **`start_month` label renamed to "Start month and year".** The widget is a month_year_picker; the old label hid the year half.
18
+ - **Full-demo seed now populates `attachment` / `jingle` / `cover`.** The installer ships `sample.txt`, `sample.wav` (440Hz / 0.5s mono PCM, generated with ffmpeg), and `sample_cover.png` under `lib/installer_templates/example_app_assets`, copies them into the generated app's `db/seed_uploads/`, and the seed migration hands File handles to CarrierWave so the three file-upload rows in the full demo render thumbnails / links instead of placeholders.
19
+
20
+ ### Added
21
+
22
+ - **`ExampleAppShowcaseLocalesAssociationsTest` integration test.** Covers `check_list` toggling the HABTM (`locale_ids` add + remove via two PUTs), `info_list` rendering the `_presentation` for attached records, and the `--` empty-state placeholder. Replaces the dropped `roles`-based assertions in `ExampleAppShowcasePageRenderTest`.
23
+
24
+ ### Lockstep
25
+
26
+ - `inline_forms`, `inline_forms_installer`, and `validation_hints` bumped from 8.1.8 to 8.1.9 in lockstep, even though `validation_hints` has no behavior change in this release.
27
+
7
28
  ## [8.1.8] - 2026-05-27
8
29
 
9
30
  ### Added
@@ -7,8 +7,19 @@ module InlineForms
7
7
 
8
8
  # dropdown_with_values
9
9
  def dropdown_with_values_show(object, attribute)
10
+ # `attribute_values` already runs every label through `t()` (see
11
+ # InlineForms::Helpers#attribute_values). Calling `t()` again here on
12
+ # an already-translated (and possibly already-rendered as
13
+ # `<span class="translation_missing">...</span>`) string used the
14
+ # whole string as an I18n key, so a missing translation rendered the
15
+ # bizarre `<span class="translation_missing" title="Low&quot;&gt;Low&lt;/Span&gt;">…</span>`
16
+ # blob the user spotted on `priority`/`priority2`. Use the already-
17
+ # translated value as-is and fall back to the empty-state placeholder
18
+ # for nil (mirrors radio_button_show and the 8.1.7 scale fixes).
10
19
  values = attribute_values(object, attribute)
11
- link_to_inline_edit object, attribute, object.send(attribute) ? t(values.assoc(object.send(attribute))[1]) : "<i class='fi-plus'></i>".html_safe, from_callee: __callee__
20
+ pair = object.send(attribute) ? values.assoc(object.send(attribute)) : nil
21
+ label = pair ? pair[1] : "<i class='fi-plus'></i>".html_safe
22
+ link_to_inline_edit object, attribute, label, from_callee: __callee__
12
23
  end
13
24
 
14
25
  def dropdown_with_values_edit(object, attribute)
@@ -31,8 +42,11 @@ module InlineForms
31
42
  end
32
43
 
33
44
  def dropdown_with_values_info(object, attribute)
45
+ # `attribute_values` already translates; do not double-translate here
46
+ # (was the same double-`t()` bug as dropdown_with_values_show).
34
47
  values = attribute_values(object, attribute)
35
- t(values.assoc(object.send(attribute))[1]) rescue '-'
48
+ pair = values.assoc(object.send(attribute))
49
+ pair ? pair[1] : '-'
36
50
  end
37
51
  INLINE_FORMS_FORM_ELEMENT
38
52
  end
@@ -6,16 +6,22 @@ module InlineForms
6
6
  # -*- encoding : utf-8 -*-
7
7
 
8
8
  def money_field_show(object, attribute)
9
- # `humanized_money_with_symbol` (money-rails) returns "" for nil/blank
10
- # which renders as an empty anchor — show the empty-state placeholder
11
- # instead, matching the nil branch on dropdown/radio show helpers.
9
+ # Two money-rails-specific quirks the bare helper used to leak:
10
+ # 1. `humanized_money_with_symbol(nil)` returns "", which renders
11
+ # as an empty `<a>` tag. Fall back to the empty-state
12
+ # placeholder used by the other choice helpers instead.
13
+ # 2. `humanized_money_with_symbol` defaults `no_cents_if_whole: true`,
14
+ # so whole-dollar amounts show without cents ("$124" instead of
15
+ # "$124.00"). That's inconsistent with non-whole amounts ("$12.34")
16
+ # and looks like a precision bug on values that rounded up to a
17
+ # whole dollar (e.g. `Money.from_amount(123.999, "USD")` rounds
18
+ # to 12400 cents → "$124" by default; "$124.00" with the override).
19
+ # Always show cents.
12
20
  value = object.send(attribute)
13
- label = if defined?(humanized_money_with_symbol) && value.respond_to?(:zero?) && !value.zero?
14
- humanized_money_with_symbol(value)
15
- elsif value.blank?
21
+ label = if value.blank?
16
22
  "<i class='fi-plus'></i>".html_safe
17
23
  else
18
- humanized_money_with_symbol(value)
24
+ humanized_money_with_symbol(value, no_cents_if_whole: false)
19
25
  end
20
26
  link_to_inline_edit object, attribute, label, from_callee: __callee__
21
27
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "8.1.8"
3
+ VERSION = "8.1.9"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.8
4
+ version: 8.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares