| Introduce `config.active_storage.draw_direct_upload_route` (#58377)
* Introduce `config.active_storage.draw_direct_upload_route`
`config.active_storage.draw_direct_upload_route` disables the direct upload route without affecting the Active Storage routes.
Fixes #58369.
* Action Text: extract `without_direct_upload_route` test helper
The form helper tests toggled `ActiveStorage.draw_direct_upload_route`
by hand and reset it to `true` instead of the previous value.
Move the toggle into a shared helper built on `ActiveStorage.with`,
so more tests can use it.
* Action Text: skip Trix uploads when the direct upload route is off
With `config.active_storage.draw_direct_upload_route = false`, the
editor renders without `data-direct-upload-url`, but dropping or
pasting a file still started a direct upload to `undefined` and
surfaced the 404 through an `alert`.
Cancel `trix-file-accept` when the editor has no direct upload URL.
* Action Text: hide the attach button when the direct upload route is off
Trix has no option to omit its attach button, so with the direct upload
route off the toolbar offered an action that could never succeed.
Remove `attachFiles` buttons from the editor's toolbar on
`trix-initialize` when the editor has no direct upload URL.
* Document how `draw_direct_upload_route` affects Action Text
Add the Action Text behaviour to the configuring guide entry and the
Active Storage CHANGELOG entry.
* Action Text: drop the emptied toolbar button group
Removing the `attachFiles` button left Trix's default toolbar with an
empty `span.trix-button-group--file-tools`, which still carries a border
and rendered as a stray vertical bar.
Remove the enclosing `[data-trix-button-group]` when taking the button
out leaves it with no children. A group holding other buttons keeps
them, and a toolbar with no groups is unaffected.
---------
Co-authored-by: Mike Dalessio |