inline_forms 8.1.84 → 8.1.85
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 +23 -0
- data/README.rdoc +1 -1
- data/app/controllers/inline_forms_controller.rb +17 -4
- data/app/helpers/inline_forms_helper.rb +9 -2
- data/archived/README.md +20 -4
- data/lib/inline_forms/archived_form_elements.rb +2 -1
- data/lib/inline_forms/version.rb +1 -1
- data/lib/inline_forms.rb +30 -15
- 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: bfea9f6d48988ef6cb10aa6631e6b35b61ab2c1833bdd3c574f1ece144c72b3e
|
|
4
|
+
data.tar.gz: 8b7d53c69dd60028833cf4b7112162baee37b4fdf18ea441d8f5cda0592bee39
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dba83a8ec7081f256cc836f45bd05bbc64a39683f2937f5ea99ec9421ff70c7a19979119db93dd2bd8c54e1c5b22d29a30423514965ac6194c19a8c266de9c82
|
|
7
|
+
data.tar.gz: db81917c887f949c399cfd4c2a217fd90073142f260802b956e8bb830563a5963e72a24fbc08a3f0714ccf90733d6837676eebb5b00604f14b99f4b64400038d
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,29 @@ All notable changes to this project are documented in this file.
|
|
|
8
8
|
|
|
9
9
|
- Known issues, parked (local note `stuff/2026-10-31-dropdown-rule-3-parked.md`) with dropdown order rule 3: `includes`, `group` or `select` in `inline_forms_list` make `dropdown` and `dropdown_with_other` raise while `/index` works, so 8.1.65's fix for a list order on a joined table holds only for `joins`, `left_joins` and `eager_load`; a has_many join gives duplicate options. Present since 8.1.60. No host's list scope has these today. Parked; not changed.
|
|
10
10
|
|
|
11
|
+
## [8.1.85] - 2026-11-25
|
|
12
|
+
|
|
13
|
+
From a review of 8.1.81 to 8.1.84 (local note `stuff/reviews/2026-11-25-review-8.1.81-8.1.84.md`).
|
|
14
|
+
|
|
15
|
+
### Security
|
|
16
|
+
|
|
17
|
+
- **`form_element=rich_text` on a `:text_area` row is refused when the app overrides any of `text_area_show`, `_edit` or `_update`**, in its helpers or on the controller. 8.1.84 looked only at `text_area_show` in the view helpers, so an app that replaced only `text_area_update` (where its checks are) or included its override only into the controller was still sent around to the engine's `rich_text_update`, and the raw HTML was saved. The same holds for `:plain_text_area` delegating to `:plain_text`. This corrects 8.1.84's Security note, which said an app's own `text_area_*` helpers were covered. No host overrides these.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **The archived-element check runs after the app's own `to_prepare` blocks.** It was the engine's `config.to_prepare`, which runs before the application's, so on a reload in development it did not yet see a vendored element's helpers that the app includes into `InlineFormsHelper` in its own `to_prepare` (yavetracker's `geo_code_curacao`). It is now registered on the app's reloader from `after_initialize` (`InlineForms.validate_loaded_models!`), after the app's blocks. The boot's own first prepare, which ran before eager loading and saw almost no models, is no longer checked; every reload is, as before. This is what 8.1.84's "yavetracker's boot exception can go now" needed: the private-helper fix alone did not change the order.
|
|
22
|
+
- **A values list that mixes numbers and strings works again.** Since 8.1.83 kept numbers as numbers, `[1, 2, "many"]` (or a `nil` entry) raised `ArgumentError: comparison of Array with Array failed` in every element that lists the values (dropdown_with_values, radio_button, scale, slider, check_box, dropdown_with_integers). Numbers now sort as numbers and anything else as text.
|
|
23
|
+
|
|
24
|
+
### Documentation
|
|
25
|
+
|
|
26
|
+
- **Vendoring an archived element:** `archived/README.md` and the boot check's hint said to put `<name>_update` in an app helper. The save calls it on the controller, which does not get the app's helpers, so such a field showed and edited but every save was refused (400; a 500 before 8.1.84). Include the module into both `InlineFormsHelper` and `InlineFormsController` in a `to_prepare`, as the README now shows (yavetracker already does).
|
|
27
|
+
- **8.1.83, not mentioned then:** a values list given as an integer Range (`0..12`) is in numeric order since 8.1.83 (0, 1, 2 … 12; it was 0, 1, 10, 11, 12, 2 …). yavetracker's `0..40`, `0..7` and `1..8` dropdowns change order.
|
|
28
|
+
- README: the tabs section's `+link_options+` renders as code again.
|
|
29
|
+
|
|
30
|
+
### Tests
|
|
31
|
+
|
|
32
|
+
- The engine header's logout link is a Turbo DELETE; an `update` override written `super and return` stops after a refusal; `MissingAttributeListError` on a field's show and save, not only on edit.
|
|
33
|
+
|
|
11
34
|
## [8.1.84] - 2026-11-24
|
|
12
35
|
|
|
13
36
|
From the second RACVS / yavetracker ladder prompt (`ladder/inline_forms-PROMPT-2-2026-11-24.md`).
|
data/README.rdoc
CHANGED
|
@@ -262,7 +262,7 @@ Two rules hold for every pattern:
|
|
|
262
262
|
- *The model keeps an instance +inline_forms_attribute_list+ with the rows of every tab.* Each field request (edit, update, a field's show) is checked against the record's list since 8.1.76, not against the tab's +@inline_forms_attribute_list+ of the page that linked to it. A model whose rows live only in a class-level structure raises +InlineForms::MissingAttributeListError+, naming the model; give it e.g. <tt>def inline_forms_attribute_list = @inline_forms_attribute_list ||= self.class.tab_fields.values.flatten(1)</tt>.
|
|
263
263
|
- *A +show+ override hands field requests to the engine with <tt>return super if params[:form_element] || …</tt>*, as above. Since 8.1.84 +show+ returns true after it has answered, a refusal included, so the older <tt>super and return if …</tt> works too; before, a refused request (400) fell through to the override's own render (DoubleRenderError).
|
|
264
264
|
|
|
265
|
-
In every case the Turbo wiring is the same
|
|
265
|
+
In every case the Turbo wiring is the same: +link_options: { data: { turbo_frame: @update_span } }+ on the +<a>+, surrounding +<turbo-frame id="<%= @update_span %>">+ in the show view, and a controller that picks the active tab via +set_tab+ + +params[:tab]+. The +InlineForms::TurboTabsBuilder+ choice is independent of which partial layout you adopt.
|
|
266
266
|
|
|
267
267
|
== Generated application +rails-i18n+
|
|
268
268
|
|
|
@@ -513,11 +513,24 @@ class InlineFormsController < ApplicationController
|
|
|
513
513
|
suffix == "update" ? respond_to?(name, true) : helpers.respond_to?(name, true)
|
|
514
514
|
end
|
|
515
515
|
|
|
516
|
-
# The element
|
|
517
|
-
#
|
|
516
|
+
# The element is the engine's own, not an app's copy of the same name:
|
|
517
|
+
# its _show, _edit and _update, in the view and on the controller, are all
|
|
518
|
+
# defined in the engine's lib/inline_forms/form_elements/. An app that
|
|
519
|
+
# overrides any one of them (only the _update with its own checks, say)
|
|
520
|
+
# keeps the delegate away. By file, not owner: `private` on an included
|
|
521
|
+
# helper (the controller makes them private, 8.1.83) gives a stub whose
|
|
522
|
+
# owner is InlineFormsController but whose source is still the engine's.
|
|
523
|
+
ENGINE_FORM_ELEMENTS_DIR = File.expand_path("../../lib/inline_forms/form_elements", __dir__) + File::SEPARATOR
|
|
524
|
+
private_constant :ENGINE_FORM_ELEMENTS_DIR
|
|
525
|
+
|
|
518
526
|
def engine_form_element?(form_element)
|
|
519
|
-
|
|
520
|
-
|
|
527
|
+
%w[show edit update].all? do |suffix|
|
|
528
|
+
name = :"#{form_element}_#{suffix}"
|
|
529
|
+
[ helpers, self ].all? do |target|
|
|
530
|
+
!target.respond_to?(name, true) ||
|
|
531
|
+
target.method(name).source_location&.first.to_s.start_with?(ENGINE_FORM_ELEMENTS_DIR)
|
|
532
|
+
end
|
|
533
|
+
end
|
|
521
534
|
rescue NameError
|
|
522
535
|
false
|
|
523
536
|
end
|
|
@@ -404,17 +404,24 @@ module InlineFormsHelper
|
|
|
404
404
|
values.to_a.each do |k, v|
|
|
405
405
|
temp << [ k, inline_forms_value_label(v) ]
|
|
406
406
|
end
|
|
407
|
-
values = temp.sort { |a, b| a[0]
|
|
407
|
+
values = temp.sort { |a, b| inline_forms_compare_values(a[0], b[0]) }
|
|
408
408
|
else
|
|
409
409
|
temp = Array.new
|
|
410
410
|
values.to_a.each_index do |i|
|
|
411
411
|
temp << [ i, inline_forms_value_label(values.to_a[i]) ]
|
|
412
412
|
end
|
|
413
|
-
values = temp.sort { |a, b| a[1]
|
|
413
|
+
values = temp.sort { |a, b| inline_forms_compare_values(a[1], b[1]) }
|
|
414
414
|
end
|
|
415
415
|
values
|
|
416
416
|
end
|
|
417
417
|
|
|
418
|
+
# Numbers in numeric order, anything else as text: a list that mixes
|
|
419
|
+
# numbers and strings ([1, 2, "many"]) raised ArgumentError in 8.1.83,
|
|
420
|
+
# once labels stopped being the strings t() returned.
|
|
421
|
+
def inline_forms_compare_values(a, b)
|
|
422
|
+
(a <=> b) || (a.to_s <=> b.to_s)
|
|
423
|
+
end
|
|
424
|
+
|
|
418
425
|
# A value as text for the screen: a Date as dd-mm-yyyy (since Rails 7.1 a
|
|
419
426
|
# bare Date prints ISO), a time as inline_forms_time_text, anything else
|
|
420
427
|
# as it is. Used by the info elements and the versions panel.
|
data/archived/README.md
CHANGED
|
@@ -43,11 +43,27 @@ Active form elements load from `app/helpers/form_elements/*.rb` only (top-level
|
|
|
43
43
|
|
|
44
44
|
An app can keep using an archived element without changing the gem: put its
|
|
45
45
|
helper methods (`<name>_show`, `<name>_edit`, `<name>_update`, and `_info` if it
|
|
46
|
-
has one) in a module
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
has one) in a module, plus the models, controllers, views, routes and assets
|
|
47
|
+
its README lists. The views call `_show` and `_edit`, but the save calls
|
|
48
|
+
`_update` on the controller, which does not get the app's helpers. So include
|
|
49
|
+
the module into both, in a `to_prepare` (both are reloadable engine
|
|
50
|
+
constants):
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
# config/initializers/inline_forms_vendored_form_elements.rb
|
|
54
|
+
require Rails.root.join("lib/form_elements/geo_code_curacao").to_s
|
|
55
|
+
|
|
56
|
+
Rails.application.config.to_prepare do
|
|
57
|
+
[InlineFormsHelper, InlineFormsController].each { |target| target.include(GeoCodeCuracaoHelper) }
|
|
58
|
+
end
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
A module only under `app/helpers/` shows and edits, but every save is refused
|
|
62
|
+
(400). Since 8.1.81 the boot check
|
|
63
|
+
(`InlineForms.validate_no_archived_form_elements_for!`) skips an archived
|
|
49
64
|
symbol when the app's helpers (`ApplicationController.helpers`) answer
|
|
50
|
-
`<name>_show`, so the element is then the app's.
|
|
65
|
+
`<name>_show`, so the element is then the app's. Since 8.1.85 that check runs
|
|
66
|
+
after the app's own `to_prepare` blocks, so the include above is seen. The archived files are
|
|
51
67
|
written in the old top-level `def` style; wrap them in a helper module
|
|
52
68
|
(`module GeoCodeCuracaoHelper … end`) and replace any jQuery/UJS they use.
|
|
53
69
|
|
|
@@ -85,7 +85,8 @@ module InlineForms
|
|
|
85
85
|
meta = ARCHIVED_FORM_ELEMENTS[key]
|
|
86
86
|
version = meta[:archived_in_version] || meta[:removed_in_version]
|
|
87
87
|
hint = if meta[:archive_path]
|
|
88
|
-
"Vendor it into your app: define #{key}_show
|
|
88
|
+
"Vendor it into your app: define #{key}_show, _edit and _update in a module and " \
|
|
89
|
+
"include it into InlineFormsHelper and InlineFormsController in a to_prepare " \
|
|
89
90
|
"(#{meta[:archive_path]}/README.md, archived/README.md)."
|
|
90
91
|
else
|
|
91
92
|
"See archived/README.md and CHANGELOG #{version}."
|
data/lib/inline_forms/version.rb
CHANGED
data/lib/inline_forms.rb
CHANGED
|
@@ -339,6 +339,24 @@ module InlineForms
|
|
|
339
339
|
attribute.to_s
|
|
340
340
|
end
|
|
341
341
|
|
|
342
|
+
# Every loaded model's attribute list: no archived element the app has not
|
|
343
|
+
# vendored, and plain_text columns present. Run on every reload, after the
|
|
344
|
+
# app's own to_prepare blocks (see the engine).
|
|
345
|
+
def self.validate_loaded_models!
|
|
346
|
+
return unless defined?(ActiveRecord::Base)
|
|
347
|
+
|
|
348
|
+
ActiveRecord::Base.descendants.each do |klass|
|
|
349
|
+
validate_no_archived_form_elements_for!(klass)
|
|
350
|
+
validate_plain_text_configuration_for!(klass)
|
|
351
|
+
rescue PlainTextColumnMissingError, ArchivedFormElementError
|
|
352
|
+
raise
|
|
353
|
+
rescue StandardError
|
|
354
|
+
# Some descendants might be abstract or temporarily unresolved while
|
|
355
|
+
# the app boots/reloads; runtime checks in controllers still enforce
|
|
356
|
+
# plain_text column presence for active resources.
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
|
|
342
360
|
def self.validate_plain_text_configuration_for!(klass)
|
|
343
361
|
return unless klass.respond_to?(:table_exists?) &&
|
|
344
362
|
klass.respond_to?(:column_names) &&
|
|
@@ -466,21 +484,18 @@ module InlineForms
|
|
|
466
484
|
]
|
|
467
485
|
end
|
|
468
486
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
# plain_text column presence for active resources.
|
|
482
|
-
end
|
|
483
|
-
end
|
|
487
|
+
# The checks of the loaded models run after the app's own to_prepare
|
|
488
|
+
# blocks (8.1.85): an app that includes a vendored element's helpers into
|
|
489
|
+
# InlineFormsHelper in its config/initializers' to_prepare must have done
|
|
490
|
+
# so before the archived-element check asks for <name>_show. A plain
|
|
491
|
+
# config.to_prepare here ran first, before the app's (engine blocks are
|
|
492
|
+
# registered before the application's), so on a reload in development
|
|
493
|
+
# the check did not see the app's helper. Registered from after_initialize,
|
|
494
|
+
# so it lands after the app's blocks; it then runs on every reload, as
|
|
495
|
+
# before. (The boot's own first prepare, before eager loading, saw almost
|
|
496
|
+
# no models; it is no longer checked.)
|
|
497
|
+
config.after_initialize do |app|
|
|
498
|
+
app.reloader.to_prepare { InlineForms.validate_loaded_models! }
|
|
484
499
|
end
|
|
485
500
|
|
|
486
501
|
# .rb too: inline_forms_titles.rb holds the title keys as lambdas.
|