diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-15 00:34:14 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-15 00:34:14 +0200 |
| commit | d15dc3f1d2c9421c44d2c82c08b44d84459fcaaf (patch) | |
| tree | cf81a626ca33512363e8f63be706ccf76166ae0e /app/views | |
| parent | b466090578d2ad3228ea61a8c8886578ea5fe91e (diff) | |
Restore from and redesign the trash list
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/nodes/trashed.html.erb | 74 |
1 files changed, 52 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 %> |
