From 616a0d2d2ba15a7e176938ee829d60366fb6a9c2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sun, 9 Aug 2026 13:26:23 +0200 Subject: Attach an asset to a page from the asset's own page The picker moves from assets/edit to assets/show, where the list of attached pages already is. A member route, POST assets/:id/attach_to_node, replaces the ride on #update. Supersedes the picker wiring in the previous commit; what remains of it is @attach_node in #create, the flash composition and the corrected hint. --- app/views/assets/edit.html.erb | 17 ----------------- app/views/assets/show.html.erb | 11 +++++++++++ 2 files changed, 11 insertions(+), 17 deletions(-) (limited to 'app/views/assets') diff --git a/app/views/assets/edit.html.erb b/app/views/assets/edit.html.erb index 5214e082..610ae20a 100644 --- a/app/views/assets/edit.html.erb +++ b/app/views/assets/edit.html.erb @@ -36,23 +36,6 @@ ) %> -
<%= t("assets.form.attach_to_page") %>
-
-
- <%= text_field_tag :asset_node_search_term, @attach_node&.title, - :placeholder => t("assets.form.attach_search_placeholder"), :autocomplete => "off" %> - -
- <%= hidden_field_tag :node_id, @attach_node&.id %> - <%= t("assets.form.attach_hint") %> -
- -
-
- - <%= t("assets.form.headline_hint") %> -
-
<%= t("admin.columns.actions") %>
diff --git a/app/views/assets/show.html.erb b/app/views/assets/show.html.erb index d76d312b..f31d34e1 100644 --- a/app/views/assets/show.html.erb +++ b/app/views/assets/show.html.erb @@ -47,6 +47,17 @@ <%= link_to new_node_path(:asset_id => @asset.id), :class => "action_button" do %> <%= icon("file-plus", library: "tabler", "aria-hidden": true) %> <%= t(".new_page_with_attachment") %> <% end %> + <%= form_tag attach_to_node_asset_path(@asset), :class => "asset_attach_form" do %> +
+ <%= text_field_tag :asset_node_search_term, nil, + :placeholder => t("assets.form.attach_search_placeholder"), :autocomplete => "off" %> + +
+ <%= hidden_field_tag :node_id, nil %> + + <%= submit_tag t(".attach_button") %> + <%= t("assets.form.attach_hint") %> + <% end %>
<%= t(".public_path") %>
-- cgit v1.3