summaryrefslogtreecommitdiff
path: root/app/views/nodes/trashed.html.erb
blob: a3c2cf413d87be280d4a64781d7f20f3a0e7c299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<h1><%= t(".title") %></h1>

<% if @nodes.empty? %>
  <p class="field_hint"><%= t(".empty") %></p>
<% else %>
  <%= will_paginate @nodes %>
  <table id="trashed_node_list">
    <tr>
      <th><%= t("admin.columns.title") %></th>
      <th><%= t(".was_at") %></th>
      <th><%= t(".trashed") %></th>
      <th><%= t("admin.columns.actions") %></th>
    </tr>
    <% @nodes.each do |node| %>
      <% entry = node.last_trash_entry %>
      <tr>
        <% doomed_below = node.descendants.count %>
        <td>
          <%= link_to (node.draft&.title || node.slug), node_path(node) %><%= " " + t(".beneath", :count => doomed_below) if doomed_below > 0 %>
        </td>
        <td><%= entry&.metadata&.dig("path", "from") %></td>
        <td>
          <% if entry %>
            <%= t(".trashed_by", :time => entry.occurred_at.strftime("%Y-%m-%d %H:%M"), :actor => entry.actor_name) %> 
          <% end %>
        </td>
        <td>
          <%= 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 %>
        </td>
      </tr>
    <% end %>
  </table>
  <%= will_paginate @nodes %>
  <p class="field_hint"><%= t(".restore_hint") %></p>
<% end %>