inline_forms 8.1.3 → 8.1.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 +18 -0
- data/inline_forms.gemspec +1 -1
- data/lib/generators/inline_forms_generator.rb +13 -2
- data/lib/inline_forms/version.rb +1 -1
- data/test/inline_forms_generator_test.rb +14 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 312520779c0b8e5a1d2ac65ae7baceaaf2c855dd200b0ea26d41920e48a8854d
|
|
4
|
+
data.tar.gz: 62441eb7d1dde51a0479c3f7225ff8a13cb7d6e6d72a5a23ce595a14c5b74aef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bf891bc7e1c84468cd5685fd73d238f4faa80779386d04dd45ef64f7057c1758b6ff8c2d294a745fe2c0e128cc2b0db28273a0ee4ed42cea4afa464c89f4fb3
|
|
7
|
+
data.tar.gz: a6f5f42359b955b53dcd907b44cf07ee3a96081f666edb2e7a01f266c4879973af34db664daed3270c392567734e1dfcdb8daf55d2fd64856f9102296c4f10f4
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [8.1.4] - 2026-05-26
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Search box on `/users` (or `/members`, etc.) silently returned the full list.** The installer-generated user model declared `scope :inline_forms_list, -> { order(:name, :id) }` but **no** `inline_forms_search` scope, so `InlineFormsController#index`'s `merge(@Klass.inline_forms_search(params[:search]))` fell through to the `ApplicationRecord` no-op (`scope :inline_forms_search, ->(_q) { all }`) and emitted `SELECT … FROM users ORDER BY name ASC, id ASC LIMIT 7` — no `WHERE`, no filter, regardless of the search query. Installer's `User` / `<custom>` model template now ships `scope :inline_forms_search, ->(q) { where("name LIKE :q OR email LIKE :q", q: "%#{q}%") }`, so `/users?search=ad` now returns rows whose name or email matches `%ad%`. Custom user-model classes via `-U <Class>` get the same scope.
|
|
12
|
+
- **Top-bar "More" dropdown was empty in every generated app** (long-standing latent bug). `lib/generators/inline_forms_generator.rb#add_tab` looked for the marker `ActionView::CompiledTemplates::MODEL_TABS = %w(` in `app/controllers/application_controller.rb`, but the installer wrote the initializer at `config/initializers/inline_forms.rb` with the marker `MODEL_TABS = %w(` and the application controller had no marker at all. Thor's `inject_into_file` silently skipped (no error, no message), so `MODEL_TABS` stayed `%w()` through every `rails g inline_forms` call. The header partial (`app/views/inline_forms/_header.html.erb`) iterated an empty list and the dropdown rendered just the chevron with no children — for years.
|
|
13
|
+
- `add_tab` now targets `config/initializers/inline_forms.rb` with the simpler marker `MODEL_TABS = %w(`, no-ops if the file or marker is missing (so consumers running `rails g inline_forms` in a non-installer-shaped app still work), and stays idempotent on re-run (skips the token if already present).
|
|
14
|
+
- Installer's initializer is now created **before** the `Locale` / `Role` `generate "inline_forms"` calls (was created at the end of the run), and is pre-seeded with the user-model's pluralised route — `MODEL_TABS = %w(<plural_route> )` — because the user model is hand-written by the installer (not generated) and would otherwise never be added.
|
|
15
|
+
- Net effect on a fresh `inline_forms create MyApp -d sqlite --example`: `MODEL_TABS = %w(owners apartments roles locales users )` (with `-U Member`: `… members `). The top-bar "More" dropdown now lists every HTML-reachable model the current `current_user` `can? :update`.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **Test skeleton (`test/inline_forms_generator_test.rb#build_destination_skeleton!`)** writes `config/initializers/inline_forms.rb` with `MODEL_TABS = %w()` (matching the installer) instead of the legacy `ActionView::CompiledTemplates::MODEL_TABS = %w()` in `application_controller.rb`. `test_generates_model_controller_route_migration_and_tab_injection` now asserts the token lands in the initializer.
|
|
20
|
+
|
|
21
|
+
### Notes
|
|
22
|
+
|
|
23
|
+
- **Example app gate (recorded):** `inline_forms create MyApp -d sqlite --example` against the freshly built **8.1.4** gem trio: install in ~71s, `bundle check: ok`, `MODEL_TABS = %w(owners apartments roles locales users )` in the initializer, **88 runs, 502 assertions, 0 failures, 0 errors, 0 skips**. Same result with `-U Member`, with `users → members` in `MODEL_TABS`.
|
|
24
|
+
|
|
7
25
|
## [8.1.3] - 2026-05-26
|
|
8
26
|
|
|
9
27
|
### Changed
|
data/inline_forms.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
20
20
|
s.require_paths = ["lib"]
|
|
21
21
|
|
|
22
|
-
s.add_dependency("validation_hints", ">= 8.1.
|
|
22
|
+
s.add_dependency("validation_hints", ">= 8.1.4", "< 9.0")
|
|
23
23
|
s.add_dependency("rails", ">= 8.1", "< 8.2")
|
|
24
24
|
s.add_dependency("rails-i18n", ">= 8.1", "< 9.0")
|
|
25
25
|
|
|
@@ -186,11 +186,22 @@ module InlineForms
|
|
|
186
186
|
def add_tab
|
|
187
187
|
return if @flag_not_accessible_through_html
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
# The installer seeds `MODEL_TABS = %w(<user_model_route> )` in
|
|
190
|
+
# `config/initializers/inline_forms.rb` before any `rails g inline_forms`
|
|
191
|
+
# runs. Inject each generated model's pluralised route token into that
|
|
192
|
+
# list so the inline_forms top-bar dropdown (rendered by
|
|
193
|
+
# `app/views/inline_forms/_header.html.erb`) surfaces every
|
|
194
|
+
# HTML-reachable model. No-op when the initializer is absent (e.g. a
|
|
195
|
+
# consumer running `rails g inline_forms` in a non-installer-shaped app)
|
|
196
|
+
# or when the token is already present (idempotent re-run).
|
|
197
|
+
relative_path = "config/initializers/inline_forms.rb"
|
|
198
|
+
marker = "MODEL_TABS = %w("
|
|
191
199
|
tab_token = "#{name.pluralize.underscore} "
|
|
192
200
|
full_path = File.join(destination_root, relative_path)
|
|
201
|
+
return unless File.exist?(full_path)
|
|
202
|
+
|
|
193
203
|
content = File.read(full_path)
|
|
204
|
+
return unless content.include?(marker)
|
|
194
205
|
return if content.include?(tab_token.rstrip)
|
|
195
206
|
|
|
196
207
|
inject_into_file relative_path, tab_token, after: marker
|
data/lib/inline_forms/version.rb
CHANGED
|
@@ -32,7 +32,7 @@ class InlineFormsGeneratorTest < Minitest::Test
|
|
|
32
32
|
model = read("app/models/thing.rb")
|
|
33
33
|
controller = read("app/controllers/things_controller.rb")
|
|
34
34
|
routes = read("config/routes.rb")
|
|
35
|
-
|
|
35
|
+
inline_forms_initializer = read("config/initializers/inline_forms.rb")
|
|
36
36
|
migration = read_single_migration_for("things")
|
|
37
37
|
|
|
38
38
|
assert_includes(model, "class Thing < ApplicationRecord")
|
|
@@ -54,7 +54,7 @@ class InlineFormsGeneratorTest < Minitest::Test
|
|
|
54
54
|
assert_includes(routes, "post 'revert', :on => :member")
|
|
55
55
|
assert_includes(routes, "get 'list_versions', :on => :member")
|
|
56
56
|
|
|
57
|
-
assert_includes(
|
|
57
|
+
assert_includes(inline_forms_initializer, "MODEL_TABS = %w(things ")
|
|
58
58
|
|
|
59
59
|
assert_includes(migration, "class InlineFormsCreateThings < ActiveRecord::Migration[8.1]")
|
|
60
60
|
assert_includes(migration, "create_table :things do |t|")
|
|
@@ -175,6 +175,7 @@ class InlineFormsGeneratorTest < Minitest::Test
|
|
|
175
175
|
|
|
176
176
|
def build_destination_skeleton!
|
|
177
177
|
mkdir_p("config")
|
|
178
|
+
mkdir_p("config/initializers")
|
|
178
179
|
mkdir_p("app/controllers")
|
|
179
180
|
mkdir_p("app/models")
|
|
180
181
|
mkdir_p("db/migrate")
|
|
@@ -192,7 +193,17 @@ class InlineFormsGeneratorTest < Minitest::Test
|
|
|
192
193
|
"app/controllers/application_controller.rb",
|
|
193
194
|
<<~RUBY
|
|
194
195
|
class ApplicationController < ActionController::Base
|
|
195
|
-
|
|
196
|
+
end
|
|
197
|
+
RUBY
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
# Matches the file the installer writes; the generator's `add_tab` step
|
|
201
|
+
# injects `<plural_route> ` tokens after the `MODEL_TABS = %w(` marker.
|
|
202
|
+
write(
|
|
203
|
+
"config/initializers/inline_forms.rb",
|
|
204
|
+
<<~RUBY
|
|
205
|
+
Rails.application.reloader.to_prepare do
|
|
206
|
+
MODEL_TABS = %w()
|
|
196
207
|
end
|
|
197
208
|
RUBY
|
|
198
209
|
)
|
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.
|
|
4
|
+
version: 8.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -17,7 +17,7 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: 8.1.
|
|
20
|
+
version: 8.1.4
|
|
21
21
|
- - "<"
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
23
|
version: '9.0'
|
|
@@ -27,7 +27,7 @@ dependencies:
|
|
|
27
27
|
requirements:
|
|
28
28
|
- - ">="
|
|
29
29
|
- !ruby/object:Gem::Version
|
|
30
|
-
version: 8.1.
|
|
30
|
+
version: 8.1.4
|
|
31
31
|
- - "<"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '9.0'
|