inline_forms 7.13.3 → 7.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec05aa4e1a1a1f21dcd041e8022943ec84af7c9b1ad4ccd90a6f57721f1732cd
4
- data.tar.gz: 05fac9919e1730afa9797d2b343a0c76484cf28c6ac0ca210daed96312699902
3
+ metadata.gz: 1852b024dd7d8d0b8f7b6d76e2ca17d4f8b9ad85dc6d2db6a4d11195164469e9
4
+ data.tar.gz: 6b9cfc0e042dc2d0146b282c779cc1cfaa547c7aaf0495bf897c125feaa16b45
5
5
  SHA512:
6
- metadata.gz: 927830ff6c84fa2642f243df6956725584b990814ffc10a357983b253117cb2c1c99f3dc7b304438becd1a20e962cae72df6714f4b570cac4c1a54fe65dc3134
7
- data.tar.gz: ad534d4e02d38e4dc6d607e18a92725cda21334a73b5a41bbea096dd5bb830fc23697a58928345ac32426fe5c3939a46106fb176068e1aa696637f2a7e7dcd6b
6
+ metadata.gz: e6ddeccc3034c47c4e0ebd087e90222b3589b767bc24891f73f8caedd89cc24d06b3cd02b8242075ca8e2c27710aee494084b422eca61e6c8b110c7dc3ecac5a
7
+ data.tar.gz: 01b1d421b8d8ec544c4b41cb42e13d0f58634aee2ff07021edc5219adbd2b3cc4f6f4b5a0f7d8308e6a6e82eb457081965735a285065e465c3c36a716a33f71e
data/CHANGELOG.md CHANGED
@@ -4,6 +4,53 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [7.13.5] - 2026-05-19
8
+
9
+ ### Changed
10
+
11
+ - **Generated app Gemfile — no more git forks for `tabs_on_rails` / `i18n-active_record`.**
12
+ - **`tabs_on_rails`:** `gem 'tabs_on_rails', '~> 3.0'` from RubyGems (weppos 3.0.0). The acesuares fork only added unused `:remote` on tab links; inline_forms uses `set_tab` only.
13
+ - **`i18n-active_record`:** removed. Generated apps never configured `I18n.backend`; only `extract_translations` read the `translations` SQL view. Replaced with **`InlineForms::TranslationRecord`** (`lib/inline_forms/translation_record.rb`) — read-only AR on the existing view (`thekey` column kept for MySQL).
14
+ - **`will_paginate`:** dropped commented acesuares git line; RubyGems only.
15
+
16
+ ### Added
17
+
18
+ - **`docs/git-deps-assessment.md`** — fork history and verification notes (local copy also under `stuff/`, gitignored).
19
+
20
+ ### Changed (also)
21
+
22
+ - **`InlineForms::VERSION`** and **`InlineFormsInstaller::VERSION`** → `7.13.5`.
23
+
24
+ ### Verified
25
+
26
+ - `gem build inline_forms.gemspec` → `inline_forms-7.13.5.gem`; `gem build inline_forms_installer.gemspec` → `inline_forms_installer-7.13.5.gem`.
27
+ - `inline_forms create MyApp -d sqlite --example` → `bundle exec rails test` — **83 runs, 461 assertions, 0 failures, 0 errors, 0 skips** (Ruby 4.0.4 / Rails 7.2.3.1). `Gemfile.lock`: `tabs_on_rails (3.0.0)` from rubygems.org; no `i18n-active_record` git source.
28
+
29
+ ## [7.13.4] - 2026-05-19
30
+
31
+ ### Fixed
32
+
33
+ - **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".
34
+ - **`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).
35
+ - **`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.
36
+
37
+ ### Added
38
+
39
+ - **`test/integration/example_app_apartment_versions_turbo_test.rb`** (installer template):
40
+ - `revert on rich_text create destroys the rich_text record so the field becomes empty` — pins the Apartment-side fix.
41
+ - `revert on nested Photo rich_text create destroys the rich_text record` — pins the originally reported nested-Photo case.
42
+ - `versions list shows Restore link on rich_text create rows` — pins the view-side link surfacing.
43
+ - `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).
44
+
45
+ ### Changed
46
+
47
+ - **`InlineForms::VERSION`** and **`InlineFormsInstaller::VERSION`** -> `7.13.4`. Companion `validation_hints` release will follow in lockstep.
48
+
49
+ ### Verified
50
+
51
+ - `gem build inline_forms.gemspec` -> `inline_forms-7.13.4.gem`; `gem build inline_forms_installer.gemspec` -> `inline_forms_installer-7.13.4.gem`.
52
+ - `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).
53
+
7
54
  ## [7.13.3] - 2026-05-19
8
55
 
9
56
  ### 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
- @parent = if defined?(ActionText::RichText) && item.is_a?(ActionText::RichText)
281
- item.record
282
- else
283
- item
284
- end
285
- return unless @parent
286
- authorize!(:revert, @parent) if cancan_enabled?
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 }
@@ -310,7 +323,7 @@ class InlineFormsController < ApplicationController
310
323
 
311
324
  def extract_translations
312
325
  keys_array = []
313
- I18n::Backend::ActiveRecord::Translation.order(:locale, :thekey).each do |t|
326
+ InlineForms::TranslationRecord.order(:locale, :thekey).each do |t|
314
327
  keys_array << deep_hashify([ t.locale, t.thekey.split('.'), t.value ].flatten)
315
328
  end
316
329
  keys_hash = {}
@@ -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` would mean destroying
55
- the record primary records already have a dedicated Destroy
56
- button (superadmin), and rich_text content can be cleared by
57
- editing. Omitting the link here keeps the UI consistent and
58
- avoids a NoMethodError in the controller's `save!`.
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
  &nbsp;
69
76
  <% elsif version.changeset.nil? || version.changeset.except("updated_at").empty? %>
70
77
  &nbsp;
@@ -0,0 +1,106 @@
1
+ # Git-sourced installer dependencies — assessment
2
+
3
+ **Date:** 2026-05-19
4
+ **Context:** Generated apps from `inline_forms create` used three non-RubyGems pins: `tabs_on_rails` (git + branch), `i18n-active_record` (git), and a commented `will_paginate` fork. This doc records why they existed and what replaced them.
5
+
6
+ **Related (risk callouts only):** `validation_hints/stuff/rails-7.2-zeitwerk-plan.md` (Track A3), `validation_hints/stuff/rails-8-checklist.md` (Phase 3).
7
+
8
+ ---
9
+
10
+ ## Summary (7.13.5+)
11
+
12
+ | Gem | Was | Now | Reason |
13
+ |-----|-----|-----|--------|
14
+ | `will_paginate` | RubyGems + commented acesuares fork | RubyGems only | Fork never active; comment removed |
15
+ | `tabs_on_rails` | `acesuares/tabs_on_rails` branch `update_remote_before_action` | `~> 3.0` (weppos, RubyGems) | Fork only added unused `:remote` on tab links; upstream 3.0.0 already uses `before_action` |
16
+ | `i18n-active_record` | `acesuares/i18n-active_record` (2012) | **Removed** — `InlineForms::TranslationRecord` | App never sets `I18n.backend`; only reads the `translations` **view** via AR |
17
+
18
+ **No generated-app Gemfile should use `:git` for these anymore.**
19
+
20
+ ---
21
+
22
+ ## `will_paginate`
23
+
24
+ - **Fork:** `https://github.com/acesuares/will_paginate.git` (commented out for years).
25
+ - **Usage:** Nested/top-level list pagination in `_list.html.erb`; Turbo Frame nav since 7.5.x (no `:remote => true`).
26
+ - **Verdict:** RubyGems `will_paginate` is sufficient. No acesuares-specific behavior required.
27
+
28
+ ---
29
+
30
+ ## `tabs_on_rails`
31
+
32
+ ### Why the fork existed
33
+
34
+ Branch `update_remote_before_action` on `acesuares/tabs_on_rails` (2019) did two things:
35
+
36
+ 1. `before_filter` → `before_action` (Rails 4+ rename).
37
+ 2. Optional `:remote => true` on `tab_for` links (`tabs_builder.rb`).
38
+
39
+ ### What inline_forms actually uses
40
+
41
+ - Controllers call **`set_tab :resource`** only (generator template + installer).
42
+ - Top bar is **not** built with `tabs_tag` / `tab_for`; `_inline_forms_tabs.html.erb` is a Foundation top-bar with search + new button.
43
+ - Turbo migration removed **`data-remote`** from inline UI; no code passes `:remote` into tabs.
44
+
45
+ ### Upstream today
46
+
47
+ - **RubyGems:** `tabs_on_rails` **3.0.0** (weppos, 2017).
48
+ - **`set_tab`** already uses **`before_action`** in `lib/tabs_on_rails/action_controller.rb`.
49
+ - **Missing vs fork:** `:remote` on tab links only — **unused by inline_forms**.
50
+
51
+ ### Verdict
52
+
53
+ **Use `gem 'tabs_on_rails', '~> 3.0'`.** No runtime dependency on the fork. Re-test on Rails 7.2+ / 8.0 when upgrading (gem is unmaintained but tiny).
54
+
55
+ ---
56
+
57
+ ## `i18n-active_record`
58
+
59
+ ### Why the fork existed
60
+
61
+ - Upstream expects a `translations` table with column **`key`**.
62
+ - MySQL reserves `KEY`; acesuares fork renamed to **`thekey`** with `alias_attribute :key, :thekey`.
63
+ - Fork is **Rails 3 era** (`set_table_name`, `attr_protected`, last push 2012).
64
+
65
+ ### What inline_forms actually uses
66
+
67
+ - Installer builds **InlineFormsKey / Locale / Translation** tables, then a SQL **VIEW** `translations` with columns `locale`, **`thekey`**, `value`, `interpolations`, `is_proc`.
68
+ - **`I18n.backend` is never configured** to `I18n::Backend::ActiveRecord` in generated apps.
69
+ - Only consumer: **`InlineFormsController#extract_translations`** (admin export of keys); not wired in default routes/tests.
70
+
71
+ ### Upstream today
72
+
73
+ - **RubyGems:** `i18n-active_record` **1.4.0** (2024), Rails 7.1+ YAML serializers, column **`key`**, optional `scope`.
74
+ - Adopting it would require renaming the view column to `key` (backtick on MySQL) and dropping the stale fork API.
75
+
76
+ ### Verdict
77
+
78
+ **Drop the gem.** Add **`InlineForms::TranslationRecord`** (`lib/inline_forms/translation_record.rb`) as a read-only AR model on the existing view with **`thekey`**. Same behavior, no git dep, Rails 7.2-safe.
79
+
80
+ If full **I18n::Backend::ActiveRecord** is needed later, pin **`i18n-active_record ~> 1.4`** and align the view schema to upstream (`key` column + initializer), not the 2012 fork.
81
+
82
+ ---
83
+
84
+ ## Previously removed forks (reference)
85
+
86
+ | Gem | Removed in | Replacement |
87
+ |-----|------------|-------------|
88
+ | `devise-i18n` | 7.3.4 / 7.10+ | RubyGems `~> 1.16` |
89
+ | `paper_trail` | 7.0.x | RubyGems `~> 16.0` |
90
+ | `switch_user` | 7.2.x | Removed from installer |
91
+
92
+ ---
93
+
94
+ ## Verification
95
+
96
+ After changing `installer_core.rb`:
97
+
98
+ ```bash
99
+ cd /home/code/inline_forms && rvm use . && gem build inline_forms.gemspec && gem build inline_forms_installer.gemspec
100
+ cd /home/code/testInline && rvm use .
101
+ gem install /home/code/inline_forms/inline_forms-*.gem /home/code/inline_forms/inline_forms_installer-*.gem
102
+ rm -rf MyApp && inline_forms create MyApp -d sqlite --example
103
+ cd MyApp && rvm use . && bundle exec rails test
104
+ ```
105
+
106
+ Expect **0 failures**; `Gemfile.lock` should list `tabs_on_rails (3.0.0)` and **no** `i18n-active_record` git source.
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InlineForms
4
+ # Read-only adapter for the +translations+ SQL view created by the installer
5
+ # (+inline_forms_create_view_for_translations+). The view exposes +thekey+
6
+ # (not +key+) so it works on MySQL where +key+ is reserved.
7
+ class TranslationRecord < ActiveRecord::Base
8
+ self.table_name = "translations"
9
+
10
+ def readonly?
11
+ true
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "7.13.3"
3
+ VERSION = "7.13.5"
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: 7.13.3
4
+ version: 7.13.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -493,6 +493,7 @@ files:
493
493
  - archived/form_elements/tree/app/helpers/form_elements/move.rb
494
494
  - archived/form_elements/tree/app/views/inline_forms/_show_tree.html.erb
495
495
  - archived/form_elements/tree/app/views/inline_forms/_tree.html.erb
496
+ - docs/git-deps-assessment.md
496
497
  - docs/jquery-widgets.md
497
498
  - docs/prompt/.gitignore
498
499
  - docs/prompt/test-the-example-app.md
@@ -553,6 +554,7 @@ files:
553
554
  - lib/inline_forms/form_elements/text_field_helper.rb
554
555
  - lib/inline_forms/form_elements/time_helper.rb
555
556
  - lib/inline_forms/gem_files.rb
557
+ - lib/inline_forms/translation_record.rb
556
558
  - lib/inline_forms/version.rb
557
559
  - lib/locales/inline_forms.en.yml
558
560
  - lib/locales/inline_forms.nl.yml