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 +++++++++++++++++++++++------ config/locales/de.yml | 1 + config/locales/en.yml | 1 + 3 files changed, 25 insertions(+), 6 deletions(-) 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 %>
diff --git a/config/locales/de.yml b/config/locales/de.yml index bc1660f4..2aec7bfa 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -714,6 +714,7 @@ de: license: "Lizenz" content_type: "Content-Type" size: "Größe" + destroy_blocked: "Vor dem Löschen zuerst von den unten genannten Seiten entfernen." new: title: "Neues Asset" edit: diff --git a/config/locales/en.yml b/config/locales/en.yml index 58c85f9e..965906df 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -682,6 +682,7 @@ en: license: "License" content_type: "Content Type" size: "Size" + destroy_blocked: "Remove it from the pages listed below before destroying it." new: title: "New asset" edit: -- cgit v1.3