inline_forms 8.1.45 → 8.1.47

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: e972af3c243b856d22f2d070a2b2499250aee36a480f2a91747748849588c040
4
- data.tar.gz: 154f76c200bb124fb4db651c720e23db9170ee9c0dd9c809256be33d3401526c
3
+ metadata.gz: a4f5d1ebb432475fd4db2c7eb7e92962b408b30a602c387f06af0b64a338cc4b
4
+ data.tar.gz: ac8c2e604daa44def24c578fced85d308c2ab7fe1b4f8f023af11e470ed97a50
5
5
  SHA512:
6
- metadata.gz: 1a0a82d1235c438a8e6bc14eab60086b86ced441f6bd8ced137cd9c5a85d76fbf6cf49b60ace8beabac928c223c4128122fbaf159bd9e3847f91d9620b0d9a1f
7
- data.tar.gz: 0f83cf85fb2f8e25109d1e9197222bad148c85f91e074b570082c8605d8f6541d95d304ed5c72c49c9a9d053d76e4abb37e61b8bb2325019cbd1dc1cb6cfc198
6
+ metadata.gz: 9717b909093e9b6c48db6a9325093bfbfc738b18f25d495a28095109b54e51e1671fa97df157570a85e55ef6f4ca278f340fbb7d1d58f6e73a05bf8cb7009f65
7
+ data.tar.gz: 3559bac6657e4ca87d33dc952d9031305db0682d6b1538e373c8193bc4e546f58d470949117d54a261676292f4fd48adb92f915cc096e76b4d69768e7de8fa92
data/CHANGELOG.md CHANGED
@@ -4,6 +4,26 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [8.1.47] - 2026-07-25
8
+
9
+ ### Fixed
10
+
11
+ - **Inline-edit save failures now show validation errors in the editor.** `InlineFormsController#update` already set `flash.now[:error]` on a failed save, but `field_edit` never rendered it (and `_edit` deliberately skips flash to avoid session notices leaking into the field). `field_edit` now displays `:error` only, inside the turbo-frame, with compact `.inline_forms_field_error` styling.
12
+
13
+ ### Lockstep
14
+
15
+ - validation_hints 8.1.47, inline_forms_installer 8.1.47, inline_forms_schema_edit 8.1.47.
16
+
17
+ ## [8.1.46] - 2026-07-24
18
+
19
+ ### Fixed
20
+
21
+ - **Model top bar no longer crashes when `@Klass` is nil.** Bespoke admin pages that render `layouts/inline_forms` from a non-`InlineFormsController` (e.g. a Stats/report controller) now show title-only chrome instead of raising on `new__path` / `link_to_new_record`. The new-record link is guarded with `<% if @Klass %>` as the per-app header did before 8.1.45.
22
+
23
+ ### Lockstep
24
+
25
+ - validation_hints 8.1.46, inline_forms_installer 8.1.46, inline_forms_schema_edit 8.1.46.
26
+
7
27
  ## [8.1.45] - 2026-07-24
8
28
 
9
29
  ### Added
@@ -468,6 +468,21 @@ turbo-frame {
468
468
  padding: 0.3em;
469
469
  margin-bottom: 0.5em;
470
470
  }
471
+
472
+ // Inline-edit validation feedback (flash.now[:error] on failed field save).
473
+ // Shown in field_edit only; _edit deliberately skips flash to avoid session notices.
474
+ .inline_forms_field_error {
475
+ font-size: 100%;
476
+ font-weight: normal;
477
+ line-height: 1.3;
478
+ margin: 0 0 0.4em;
479
+ padding: 0.35em 0.5em;
480
+
481
+ ul {
482
+ margin: 0;
483
+ padding-left: 1.2em;
484
+ }
485
+ }
471
486
  .success {
472
487
  color: var(--if-color-on-dark);
473
488
  font-weight: bold;
@@ -28,9 +28,11 @@
28
28
  <%= render "inline_forms/generic_search" %>
29
29
  </li>
30
30
  <% end %>
31
- <li>
32
- <%= link_to_new_record(@Klass, "new_#{@Klass.to_s.singularize.underscore}_path", @Klass.to_s.pluralize.downcase + "_list") %>
33
- </li>
31
+ <% if @Klass %>
32
+ <li>
33
+ <%= link_to_new_record(@Klass, "new_#{@Klass.to_s.singularize.underscore}_path", @Klass.to_s.pluralize.downcase + "_list") %>
34
+ </li>
35
+ <% end %>
34
36
  </ul>
35
37
  </div>
36
38
  </nav>
@@ -1,3 +1,9 @@
1
1
  <turbo-frame id="<%= @update_span %>">
2
+ <% field_errors = flash[:error] %>
3
+ <% if field_errors.present? %>
4
+ <div class="flash error inline_forms_field_error" role="alert">
5
+ <ul><% Array(field_errors).each do |m| %><li><%= m %></li><% end %></ul>
6
+ </div>
7
+ <% end %>
2
8
  <%= render partial: "inline_forms/edit" %>
3
9
  </turbo-frame>
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module InlineForms
4
- VERSION = "8.1.45"
4
+ VERSION = "8.1.47"
5
5
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Bespoke report page: uses the inline_forms admin layout but is not an
4
+ # InlineFormsController, so @Klass is never set (mirrors StProject Stats).
5
+ class StatsController < ApplicationController
6
+ layout "inline_forms"
7
+
8
+ def show
9
+ end
10
+ end
@@ -6,6 +6,7 @@ class Widget < ApplicationRecord
6
6
  belongs_to :kind, optional: true
7
7
 
8
8
  validates :name, presence: true
9
+ validates :notes, length: { minimum: 10 }, allow_blank: true
9
10
 
10
11
  scope :inline_forms_list, -> { order(:name, :id) }
11
12
  inline_forms_search_on :name
@@ -0,0 +1 @@
1
+ <p id="stats_report">Stats report</p>
@@ -25,6 +25,8 @@ Rails.application.routes.draw do
25
25
  get "list_versions", on: :member
26
26
  end
27
27
 
28
+ get "stats", to: "stats#show"
29
+
28
30
  # Schema-change GUI (opt-in in real installs; routed here for the engine's
29
31
  # fast test suite). One line, so gem upgrades can add routes freely.
30
32
  InlineFormsSchemaEdit.draw_routes(self)
@@ -71,6 +71,30 @@ class InlineFormsCrudTest < InlineFormsIntegrationTestCase
71
71
  assert_equal "Alpha", @widget.reload.name, "blank name must not persist"
72
72
  assert_includes response.body, %(name="name"),
73
73
  "expected the edit input to be re-rendered after a failed save"
74
+ assert_includes response.body, "inline_forms_field_error"
75
+ assert_includes response.body, "can&#39;t be blank"
76
+ end
77
+
78
+ test "failed save with invalid value shows validation errors in the editor" do
79
+ frame = "widget_#{@widget.id}_notes"
80
+ put widget_path(@widget, attribute: "notes", form_element: "plain_text_area",
81
+ update: frame),
82
+ params: { notes: "short" }, headers: frame_headers(frame)
83
+
84
+ assert_response :success
85
+ assert_nil @widget.reload.notes
86
+ assert_includes response.body, "inline_forms_field_error"
87
+ assert_includes response.body, "is too short"
88
+ end
89
+
90
+ test "edit render shows no field error when flash is empty" do
91
+ frame = "widget_#{@widget.id}_name"
92
+ get edit_widget_path(@widget, attribute: "name", form_element: "text_field",
93
+ update: frame),
94
+ headers: frame_headers(frame)
95
+
96
+ assert_response :success
97
+ refute_includes response.body, "inline_forms_field_error"
74
98
  end
75
99
 
76
100
  test "destroy responds with the destroyed-row state and an undo pointing at the destroy version" do
@@ -43,4 +43,14 @@ class ModelTopBarTest < InlineFormsIntegrationTestCase
43
43
  assert_includes response.body, "Alpha"
44
44
  refute_includes response.body, "Beta"
45
45
  end
46
+
47
+ test "non-model page with no @Klass renders title only, no new-record link" do
48
+ get stats_path
49
+
50
+ assert_response :success
51
+ assert_includes response.body, %(id="inline_forms_model_top_bar")
52
+ assert_includes response.body, %(id="stats_report")
53
+ refute_includes response.body, "new_button"
54
+ refute_includes response.body, %(id="input_search")
55
+ end
46
56
  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.45
4
+ version: 8.1.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -272,6 +272,7 @@ files:
272
272
  - test/dummy/app/controllers/gizmos_controller.rb
273
273
  - test/dummy/app/controllers/machines_controller.rb
274
274
  - test/dummy/app/controllers/parts_controller.rb
275
+ - test/dummy/app/controllers/stats_controller.rb
275
276
  - test/dummy/app/controllers/widgets_controller.rb
276
277
  - test/dummy/app/helpers/application_helper.rb
277
278
  - test/dummy/app/models/application_record.rb
@@ -281,6 +282,7 @@ files:
281
282
  - test/dummy/app/models/part.rb
282
283
  - test/dummy/app/models/widget.rb
283
284
  - test/dummy/app/views/_gizmos_search.html.erb
285
+ - test/dummy/app/views/stats/show.html.erb
284
286
  - test/dummy/config/application.rb
285
287
  - test/dummy/config/database.yml
286
288
  - test/dummy/config/environment.rb
@@ -341,6 +343,7 @@ test_files:
341
343
  - test/dummy/app/controllers/gizmos_controller.rb
342
344
  - test/dummy/app/controllers/machines_controller.rb
343
345
  - test/dummy/app/controllers/parts_controller.rb
346
+ - test/dummy/app/controllers/stats_controller.rb
344
347
  - test/dummy/app/controllers/widgets_controller.rb
345
348
  - test/dummy/app/helpers/application_helper.rb
346
349
  - test/dummy/app/models/application_record.rb
@@ -350,6 +353,7 @@ test_files:
350
353
  - test/dummy/app/models/part.rb
351
354
  - test/dummy/app/models/widget.rb
352
355
  - test/dummy/app/views/_gizmos_search.html.erb
356
+ - test/dummy/app/views/stats/show.html.erb
353
357
  - test/dummy/config/application.rb
354
358
  - test/dummy/config/database.yml
355
359
  - test/dummy/config/environment.rb