From 8b6d3c76451d4ece5fd829d0e2d96a00aa19122d Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 22 Jul 2026 20:44:34 +0200 Subject: Add attached nodes subsection in assets#show and thumbnail in nodes#create --- app/views/assets/show.html.erb | 25 +++++++++++++++++++++++++ app/views/nodes/new.html.erb | 18 ++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'app/views') diff --git a/app/views/assets/show.html.erb b/app/views/assets/show.html.erb index e551e358..27238211 100644 --- a/app/views/assets/show.html.erb +++ b/app/views/assets/show.html.erb @@ -21,6 +21,31 @@
<%= image_tag @asset.upload.url(:medium), style: "max-width: 300px; max-height: 300px;" %>
<% end %> +
Attached to
+
+ <% nodes = @asset.attached_nodes %> + <% if nodes.any? %> + + <% else %> + — not attached to any page — + <% end %> + <%= link_to new_node_path(:asset_id => @asset.id), :class => "action_button" do %> + <%= icon("file-plus", library: "tabler", "aria-hidden": true) %> New page with this attachment + <% end %> +
+
Public Path
<% public_path = @asset.upload.url.sub(/\?\d+$/, "") %> diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb index 805fbc91..1303e9ed 100644 --- a/app/views/nodes/new.html.erb +++ b/app/views/nodes/new.html.erb @@ -48,6 +48,24 @@ This preview updates as you type. The final path can still be changed afterward by editing the title (for the last segment) or moving the node to a different parent (for everything before it).
+ <% if @attach_asset %> +
attachment
+
+ + This asset will automatically be attached to the new page. + + <%= hidden_field_tag :asset_id, @attach_asset.id %> +
+ <% end %> +
<%= submit_tag "Create" %>
-- cgit v1.3