From d15dc3f1d2c9421c44d2c82c08b44d84459fcaaf Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 15 Aug 2026 00:34:14 +0200 Subject: Restore from and redesign the trash list --- app/views/nodes/trashed.html.erb | 74 ++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 22 deletions(-) (limited to 'app') diff --git a/app/views/nodes/trashed.html.erb b/app/views/nodes/trashed.html.erb index a3c2cf41..39fc965f 100644 --- a/app/views/nodes/trashed.html.erb +++ b/app/views/nodes/trashed.html.erb @@ -4,37 +4,67 @@

<%= t(".empty") %>

<% else %> <%= will_paginate @nodes %> - - - - - - - +
<%= t("admin.columns.title") %><%= t(".was_at") %><%= t(".trashed") %><%= t("admin.columns.actions") %>
+ <% @nodes.each do |node| %> <% entry = node.last_trash_entry %> + <% doomed_below = node.descendants.count %> + <% title = node.draft&.title || node.slug %> + <% target_missing = (node.draft || node.head)&.parent_node_missing? %> - <% doomed_below = node.descendants.count %> - - - - <% end %> +
- <%= link_to (node.draft&.title || node.slug), node_path(node) %><%= " " + t(".beneath", :count => doomed_below) if doomed_below > 0 %> - <%= entry&.metadata&.dig("path", "from") %> + +
+ <%= link_to title, node_path(node) %><%= " " + t(".beneath", :count => doomed_below) if doomed_below > 0 %> +
+
+ <%= t(".was_at") %> <%= entry&.metadata&.dig("path", "from") %> +
<% if entry %> - <%= t(".trashed_by", :time => entry.occurred_at.strftime("%Y-%m-%d %H:%M"), :actor => entry.actor_name) %> +
+ <%= t(".trashed_by", :time => admin_datetime(entry.occurred_at), + :actor => entry.actor_name) %> +
<% end %>
- <%= button_to node_path(node), method: :delete, - form: { data: { confirm: t(".confirm_delete", :title => (node.draft&.title || node.slug), :count => doomed_below) }, - class: 'button_to destructive' } do %> - <%= icon("trash-x", library: "tabler", "aria-hidden": true) %> - <%= t(".delete_permanently") %> - <% end %> + +
+ + <%= link_to node_path(node), "aria-label" => t("admin.common.show"), + title: t("admin.common.show") do %> + <%= icon("eye", library: "tabler", "aria-hidden": true) %> + <% end %> + + + <% if target_missing %> + " + aria-label="<%= t(".restore_target_missing") %>"> + <%= icon("arrow-back-up", library: "tabler", "aria-hidden": true) %> + + <% else %> + <%= button_to restore_from_trash_node_path(node), method: :put, + form: { class: 'button_to state_changing' }, + "aria-label" => t(".restore_here"), title: t(".restore_here") do %> + <%= icon("arrow-back-up", library: "tabler", "aria-hidden": true) %> + <% end %> + <% end %> + + + <%= button_to node_path(node), method: :delete, + form: { data: { confirm: t(".confirm_delete", :title => title, :count => doomed_below) }, + class: 'button_to destructive' }, + "aria-label" => t(".delete_permanently"), + title: t(".delete_permanently") do %> + <%= icon("trash-x", library: "tabler", "aria-hidden": true) %> + <% end %> + +
<%= will_paginate @nodes %> -

<%= t(".restore_hint") %>

+ <% if @nodes.any? { |n| (n.draft || n.head)&.parent_node_missing? } %> +

<%= t(".restore_hint") %>

+ <% end %> <% end %> -- cgit v1.3