From ed3905b5409190c1e11c2c49c2163ac967c6d8b9 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sun, 9 Aug 2026 14:23:41 +0200 Subject: Offer destroying an asset from its own page --- app/views/assets/show.html.erb | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'app/views') diff --git a/app/views/assets/show.html.erb b/app/views/assets/show.html.erb index 60d63290..c261e032 100644 --- a/app/views/assets/show.html.erb +++ b/app/views/assets/show.html.erb @@ -6,16 +6,33 @@
- <%= link_to edit_asset_path(@asset), class: 'action_button' do %> - <%= icon("edit", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.edit") %> - <% end %> + <%= link_to edit_asset_path(@asset), class: 'action_button' do %> + <%= icon("edit", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.edit") %> + <% end %> +
+
+ <%= link_to admin_log_path(:asset_id => @asset.id), :class => "action_button" do %> + <%= icon("history", library: "tabler", "aria-hidden": true) %> <%= t("node_actions.asset_history") %> + <% end %> +
+
+ <% if @asset.attached_nodes.any? %> + + <%= icon("trash", library: "tabler", "aria-hidden": true) %> + <%= t("admin.common.destroy") %> + + <%= t(".destroy_blocked") %> + <% else %> + <%= button_to asset_path(@asset), method: :delete, + form: { data: { confirm: t("admin.common.confirm_sure") }, + class: 'button_to destructive' } do %> + <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.destroy") %> + <% end %> + <% end %>
<%= link_to t("admin.common.back"), assets_path %>
- <%= link_to admin_log_path(:asset_id => @asset.id), :class => "action_button" do %> - <%= icon("history", library: "tabler", "aria-hidden": true) %> <%= t("node_actions.asset_history") %> - <% end %>
-- cgit v1.3