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 +4 -4
- data/CHANGELOG.md +20 -0
- data/app/assets/stylesheets/inline_forms/inline_forms.scss +15 -0
- data/app/views/inline_forms/_model_top_bar.html.erb +5 -3
- data/app/views/inline_forms/field_edit.html.erb +6 -0
- data/lib/inline_forms/version.rb +1 -1
- data/test/dummy/app/controllers/stats_controller.rb +10 -0
- data/test/dummy/app/models/widget.rb +1 -0
- data/test/dummy/app/views/stats/show.html.erb +1 -0
- data/test/dummy/config/routes.rb +2 -0
- data/test/integration/inline_forms_crud_test.rb +24 -0
- data/test/integration/model_top_bar_test.rb +10 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4f5d1ebb432475fd4db2c7eb7e92962b408b30a602c387f06af0b64a338cc4b
|
|
4
|
+
data.tar.gz: ac8c2e604daa44def24c578fced85d308c2ab7fe1b4f8f023af11e470ed97a50
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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>
|
data/lib/inline_forms/version.rb
CHANGED
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p id="stats_report">Stats report</p>
|
data/test/dummy/config/routes.rb
CHANGED
|
@@ -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'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.
|
|
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
|