summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-15 00:34:14 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-15 00:34:14 +0200
commitd15dc3f1d2c9421c44d2c82c08b44d84459fcaaf (patch)
treecf81a626ca33512363e8f63be706ccf76166ae0e
parentb466090578d2ad3228ea61a8c8886578ea5fe91e (diff)
Restore from and redesign the trash list
-rw-r--r--app/views/nodes/trashed.html.erb74
-rw-r--r--config/locales/de.yml2
-rw-r--r--config/locales/en.yml2
-rw-r--r--public/stylesheets/admin.css1
4 files changed, 57 insertions, 22 deletions
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 @@
4 <p class="field_hint"><%= t(".empty") %></p> 4 <p class="field_hint"><%= t(".empty") %></p>
5<% else %> 5<% else %>
6 <%= will_paginate @nodes %> 6 <%= will_paginate @nodes %>
7 <table id="trashed_node_list"> 7 <table class="admin_table trashed_node_list">
8 <tr> 8 <tbody>
9 <th><%= t("admin.columns.title") %></th>
10 <th><%= t(".was_at") %></th>
11 <th><%= t(".trashed") %></th>
12 <th><%= t("admin.columns.actions") %></th>
13 </tr>
14 <% @nodes.each do |node| %> 9 <% @nodes.each do |node| %>
15 <% entry = node.last_trash_entry %> 10 <% entry = node.last_trash_entry %>
11 <% doomed_below = node.descendants.count %>
12 <% title = node.draft&.title || node.slug %>
13 <% target_missing = (node.draft || node.head)&.parent_node_missing? %>
16 <tr> 14 <tr>
17 <% doomed_below = node.descendants.count %> 15 <td class="title">
18 <td> 16 <div class="row_primary">
19 <%= link_to (node.draft&.title || node.slug), node_path(node) %><%= " " + t(".beneath", :count => doomed_below) if doomed_below > 0 %> 17 <%= link_to title, node_path(node) %><%= " " + t(".beneath", :count => doomed_below) if doomed_below > 0 %>
20 </td> 18 </div>
21 <td><%= entry&.metadata&.dig("path", "from") %></td> 19 <div class="row_secondary">
22 <td> 20 <%= t(".was_at") %> <%= entry&.metadata&.dig("path", "from") %>
21 </div>
23 <% if entry %> 22 <% if entry %>
24 <%= t(".trashed_by", :time => entry.occurred_at.strftime("%Y-%m-%d %H:%M"), :actor => entry.actor_name) %> 23 <div class="row_secondary">
24 <%= t(".trashed_by", :time => admin_datetime(entry.occurred_at),
25 :actor => entry.actor_name) %>
26 </div>
25 <% end %> 27 <% end %>
26 </td> 28 </td>
27 <td> 29 <td class="actions">
28 <%= button_to node_path(node), method: :delete, 30 <div class="action_grid">
29 form: { data: { confirm: t(".confirm_delete", :title => (node.draft&.title || node.slug), :count => doomed_below) }, 31 <span class="action_item">
30 class: 'button_to destructive' } do %> 32 <%= link_to node_path(node), "aria-label" => t("admin.common.show"),
31 <%= icon("trash-x", library: "tabler", "aria-hidden": true) %> 33 title: t("admin.common.show") do %>
32 <%= t(".delete_permanently") %> 34 <%= icon("eye", library: "tabler", "aria-hidden": true) %>
33 <% end %> 35 <% end %>
36 </span>
37 <span class="action_item">
38 <% if target_missing %>
39 <span class="disabled_action" title="<%= t(".restore_target_missing") %>"
40 aria-label="<%= t(".restore_target_missing") %>">
41 <%= icon("arrow-back-up", library: "tabler", "aria-hidden": true) %>
42 </span>
43 <% else %>
44 <%= button_to restore_from_trash_node_path(node), method: :put,
45 form: { class: 'button_to state_changing' },
46 "aria-label" => t(".restore_here"), title: t(".restore_here") do %>
47 <%= icon("arrow-back-up", library: "tabler", "aria-hidden": true) %>
48 <% end %>
49 <% end %>
50 </span>
51 <span class="action_item">
52 <%= button_to node_path(node), method: :delete,
53 form: { data: { confirm: t(".confirm_delete", :title => title, :count => doomed_below) },
54 class: 'button_to destructive' },
55 "aria-label" => t(".delete_permanently"),
56 title: t(".delete_permanently") do %>
57 <%= icon("trash-x", library: "tabler", "aria-hidden": true) %>
58 <% end %>
59 </span>
60 </div>
34 </td> 61 </td>
35 </tr> 62 </tr>
36 <% end %> 63 <% end %>
64 </tbody>
37 </table> 65 </table>
38 <%= will_paginate @nodes %> 66 <%= will_paginate @nodes %>
39 <p class="field_hint"><%= t(".restore_hint") %></p> 67 <% if @nodes.any? { |n| (n.draft || n.head)&.parent_node_missing? } %>
68 <p class="field_hint"><%= t(".restore_hint") %></p>
69 <% end %>
40<% end %> 70<% end %>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 4e19bcc1..c6082bcd 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -562,6 +562,8 @@ de:
562 empty: "Der Papierkorb ist leer." 562 empty: "Der Papierkorb ist leer."
563 was_at: "War unter" 563 was_at: "War unter"
564 trashed: "Gelöscht" 564 trashed: "Gelöscht"
565 restore_here: "Hierhin wiederherstellen"
566 restore_target_missing: "Kann nicht von hier aus wiederhergestellt werden, das der alte Eltern-Node nicht mehr existiert."
565 beneath: 567 beneath:
566 one: "(+ 1 darunter)" 568 one: "(+ 1 darunter)"
567 other: "(+ %{count} darunter)" 569 other: "(+ %{count} darunter)"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 83373bcd..5aafb612 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -514,6 +514,8 @@ en:
514 empty: "The Trash is empty." 514 empty: "The Trash is empty."
515 was_at: "Was at" 515 was_at: "Was at"
516 trashed: "Trashed" 516 trashed: "Trashed"
517 restore_here: "Restore here"
518 restore_target_missing: "Can not restore from here. Old parent is gone."
517 beneath: 519 beneath:
518 one: "(+ 1 beneath)" 520 one: "(+ 1 beneath)"
519 other: "(+ %{count} beneath)" 521 other: "(+ %{count} beneath)"
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css
index 6471090e..4afe0cfa 100644
--- a/public/stylesheets/admin.css
+++ b/public/stylesheets/admin.css
@@ -888,6 +888,7 @@ form.button_to svg {
888.events_table .action_grid { grid-template-columns: repeat(2, auto); } 888.events_table .action_grid { grid-template-columns: repeat(2, auto); }
889.assets_table .action_grid { grid-template-columns: repeat(3, auto); } 889.assets_table .action_grid { grid-template-columns: repeat(3, auto); }
890.revisions_table .action_grid { grid-template-columns: repeat(2, auto); } 890.revisions_table .action_grid { grid-template-columns: repeat(2, auto); }
891.trashed_node_list .action_grid { grid-template-columns: repeat(3, auto); }
891 892
892/* min-height keeps a row the same height whether or not the viewer may see 893/* min-height keeps a row the same height whether or not the viewer may see
893 the lower controls. */ 894 the lower controls. */