inline_forms 7.13.3 → 7.13.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 +4 -4
- data/CHANGELOG.md +25 -0
- data/app/controllers/inline_forms_controller.rb +20 -7
- data/app/views/inline_forms/_versions_list.html.erb +13 -6
- data/lib/inline_forms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a68d0c92e72d9f2a1adb026157f51097a12f77fa704be1c25c934178a540142
|
|
4
|
+
data.tar.gz: eeb3d95f3e6e1f988a3a5cad6a176ff4c503f8a6efab22f8ca9e03029457ae8e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3411a60ef7e26d8994a47daf32ca10455ac6aee511f35b198afaa0ea53172cd009c5dd9632d069f05039ecd24ffca0508d2e3fbcd0b2ce93712e351a8f919d0
|
|
7
|
+
data.tar.gz: 01b8cff956c04ae458e1ea5b76534a5e741fb4845b518021cad5d6253693f54a8782ae802b504984ef3136a80fd3446a4db99e1584a3c0162e39ddec08f4c031
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ All notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [7.13.4] - 2026-05-19
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Restore on a rich_text `create` version was asymmetric** depending on what the first save of the field happened to look like. If the field's first rich_text save was empty (e.g. opening the inline editor and saving without typing — common on top-level Apartments), the user later got a `create` (body: nil -> "") plus an `update` (body: "" -> "...") and could click Restore on the update to clear the field. If the first save already had content (more common on nested Photo descriptions), the field had only the `create` version and the 7.13.2 hide-Restore-on-create rule meant there was no Restore link at all — the user reported "I can restore the empty value on Apartments but not on the nested Photo".
|
|
12
|
+
- **`app/views/inline_forms/_versions_list.html.erb`**: show the Restore link on `:rich_text` `create` rows (still hide it on `:primary` `create` rows — those would mean destroying the parent record, which is the Destroy button's job).
|
|
13
|
+
- **`app/controllers/inline_forms_controller.rb#revert`**: when `reify` is nil and `@version.item` is an `ActionText::RichText`, treat the revert as "undo the creation" — destroy the rich_text row, `touch` the parent, and respond with the existing turbo-stream replacing the row + versions frames. Primary `create` reverts (only reachable via replayed URLs since the view hides the link) still no-op cleanly through the same handler.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`test/integration/example_app_apartment_versions_turbo_test.rb`** (installer template):
|
|
18
|
+
- `revert on rich_text create destroys the rich_text record so the field becomes empty` — pins the Apartment-side fix.
|
|
19
|
+
- `revert on nested Photo rich_text create destroys the rich_text record` — pins the originally reported nested-Photo case.
|
|
20
|
+
- `versions list shows Restore link on rich_text create rows` — pins the view-side link surfacing.
|
|
21
|
+
- `versions list hides Restore link on primary create rows but keeps it on update rows` — clarifies the asymmetry between `:primary` and `:rich_text` create rows (renames the earlier test).
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **`InlineForms::VERSION`** and **`InlineFormsInstaller::VERSION`** -> `7.13.4`. Companion `validation_hints` release will follow in lockstep.
|
|
26
|
+
|
|
27
|
+
### Verified
|
|
28
|
+
|
|
29
|
+
- `gem build inline_forms.gemspec` -> `inline_forms-7.13.4.gem`; `gem build inline_forms_installer.gemspec` -> `inline_forms_installer-7.13.4.gem`.
|
|
30
|
+
- `inline_forms create MyApp -d sqlite --example` -> `bundle exec rails test` -- **83 runs, 0 failures, 0 errors, 0 skips** (Ruby 4.0.4 / Rails 7.2.3.1).
|
|
31
|
+
|
|
7
32
|
## [7.13.3] - 2026-05-19
|
|
8
33
|
|
|
9
34
|
### Fixed
|
|
@@ -276,14 +276,27 @@ class InlineFormsController < ApplicationController
|
|
|
276
276
|
# case a request was bookmarked or replayed: render close on the
|
|
277
277
|
# current parent without mutating anything.
|
|
278
278
|
if @object.nil?
|
|
279
|
+
# reify returns nil for `create` events (no prior state). For a
|
|
280
|
+
# rich_text create, reverting means "undo the creation" -> destroy
|
|
281
|
+
# the ActionText::RichText row so the parent's field reverts to
|
|
282
|
+
# empty (symmetric with reverting an update on a rich_text that
|
|
283
|
+
# was first saved empty). For a primary record we never offer
|
|
284
|
+
# Restore on `create` in the view; this branch only runs for
|
|
285
|
+
# replayed/bookmarked URLs and must remain a no-op response keyed
|
|
286
|
+
# off the parent.
|
|
279
287
|
item = @version.item
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
if defined?(ActionText::RichText) && item.is_a?(ActionText::RichText)
|
|
289
|
+
@rich_text_record = item
|
|
290
|
+
@parent = @rich_text_record.record
|
|
291
|
+
return unless @parent
|
|
292
|
+
authorize!(:revert, @parent) if cancan_enabled?
|
|
293
|
+
@rich_text_record.destroy
|
|
294
|
+
@parent.touch if @parent.respond_to?(:touch)
|
|
295
|
+
else
|
|
296
|
+
@parent = item
|
|
297
|
+
return unless @parent
|
|
298
|
+
authorize!(:revert, @parent) if cancan_enabled?
|
|
299
|
+
end
|
|
287
300
|
return unless row_html_turbo_allowed?
|
|
288
301
|
respond_to do |format|
|
|
289
302
|
format.turbo_stream { render_revert_turbo_streams }
|
|
@@ -51,11 +51,18 @@
|
|
|
51
51
|
parent's controller, so the same path works for both kinds.
|
|
52
52
|
|
|
53
53
|
PaperTrail's `reify` returns nil for `create` versions (no prior
|
|
54
|
-
state to roll back to). Reverting a `create
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
state to roll back to). Reverting a `create`:
|
|
55
|
+
* on a :rich_text entry -> destroy the ActionText::RichText
|
|
56
|
+
record, i.e. clear the field. The Restore link is shown so
|
|
57
|
+
the user can symmetrically undo "I added content" the same
|
|
58
|
+
way they can undo "I edited content" — without this, a
|
|
59
|
+
field whose rich_text was first saved with non-empty content
|
|
60
|
+
had no Restore link at all (asymmetric with parents whose
|
|
61
|
+
first save happened to be empty).
|
|
62
|
+
* on a :primary entry -> would mean destroying the parent
|
|
63
|
+
record itself. Primary records already have a dedicated
|
|
64
|
+
Destroy button (superadmin); the Restore link stays hidden
|
|
65
|
+
so the action is never offered ambiguously here.
|
|
59
66
|
|
|
60
67
|
Empty-changeset update rows (e.g. PaperTrail `touch` events from
|
|
61
68
|
`belongs_to ..., touch: true` on associated ActionText::RichText
|
|
@@ -64,7 +71,7 @@
|
|
|
64
71
|
tracking (`has_paper_trail on: [:create, :update, :destroy]`),
|
|
65
72
|
but legacy apps still have these rows in the audit trail; the
|
|
66
73
|
link is hidden here so the action is never offered. -%>
|
|
67
|
-
<% if version.event == "create" %>
|
|
74
|
+
<% if version.event == "create" && entry[:kind] != :rich_text %>
|
|
68
75
|
|
|
69
76
|
<% elsif version.changeset.nil? || version.changeset.except("updated_at").empty? %>
|
|
70
77
|
|
data/lib/inline_forms/version.rb
CHANGED