From d41ee504caedbe858e24ab2a23c7a804454c64c8 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 18 Jul 2026 02:15:29 +0200 Subject: Add Trash affordances: cockpit, listing, dashboard entry nodes#show gains a Trash section on trashed nodes: provenance from the trash entry, a restore form whose parent picker pre-fills the old parent while it still lives, and permanent deletion. A Move-to-Trash button joins the status actions on living nodes. nodes#trashed lists trashed subtree roots with weight, provenance, and deletion; the dashboard housekeeping row links to it, and trash/destroy redirect there. Deletion from Trash now removes the whole subtree, deepest first, each node through a real destroy! so every per-node cascade runs -- amending the never-recursive rule for this one sanctioned path (both confirms state the count; the root entry carries destroyed_descendants). Bare Node#destroy still refuses children. --- app/views/nodes/trashed.html.erb | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app/views/nodes/trashed.html.erb (limited to 'app/views/nodes/trashed.html.erb') diff --git a/app/views/nodes/trashed.html.erb b/app/views/nodes/trashed.html.erb new file mode 100644 index 0000000..9a4808e --- /dev/null +++ b/app/views/nodes/trashed.html.erb @@ -0,0 +1,42 @@ +

Trash

+ +<% if @nodes.empty? %> +

The Trash is empty.

+<% else %> + <%= will_paginate @nodes %> + + + + + + + + <% @nodes.each do |node| %> + <% entry = node.last_trash_entry %> + + <% doomed_below = node.descendants.count %> + + + + + + <% end %> +
TitleWas atTrashedActions
+ <%= link_to (node.draft&.title || node.slug), node_path(node) %><%= " (+ #{doomed_below} beneath)" if doomed_below > 0 %> + <%= entry&.metadata&.dig("path", "from") %> + <% if entry %> + <%= entry.occurred_at.strftime("%Y-%m-%d %H:%M") %> by <%= entry.actor_name %> + <% end %> + + <%= button_to node_path(node), method: :delete, + form: { data: { confirm: doomed_below > 0 ? + "Delete \"#{node.draft&.title || node.slug}\" and the #{doomed_below} pages beneath it permanently? This cannot be undone." : + "Delete \"#{node.draft&.title || node.slug}\" permanently? This cannot be undone." }, + class: 'button_to destructive' } do %> + <%= icon("trash-x", library: "tabler", "aria-hidden": true) %> + Delete permanently + <% end %> +
+ <%= will_paginate @nodes %> +

To restore a page, open it and pick a new parent in its Trash section.

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