summaryrefslogtreecommitdiff
path: root/app/views/admin/index.html.erb
blob: e3591c4e3ac1bd090d1e8d768fd5b306ba7faa1c (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<h1><%= t(".title") %></h1>
<div id="dashboard_search">
  <%= form_tag admin_search_path, method: :get do %>
    <%= text_field_tag :search_term, nil, id: "dashboard_search_term", placeholder: t(".search_placeholder"), autocomplete: "off" %>
  <% end %>
  <div id="dashboard_search_results" class="search_results"></div>
</div>

<div id="dashboard_signposts" class="button_row">
  <%= link_to new_node_path, class: "action_button" do %>
    <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_post") %>
  <% end %>
  <%= link_to chapters_nodes_path, class: "action_button" do %>
    <%= icon("map-pin", library: "tabler", "aria-hidden": true) %> <%= t(".find_chapter") %>
  <% end %>
  <%= link_to new_asset_path, class: "action_button" do %>
    <%= icon("upload", library: "tabler", "aria-hidden": true) %> <%= t(".upload_asset") %>
  <% end %>
  <%= link_to sitemap_nodes_path, class: "action_button" do %>
    <%= icon("list-tree", library: "tabler", "aria-hidden": true) %> <%= t(".add_in_tree") %>
  <% end %>
</div>

<div id="dashboard_widgets">
  <div class="dashboard_widget">
    <h3><%= t(".drafts_widget", :total => @drafts_total) %></h3>
    <ul>
      <% @drafts.each do |node| %>
        <li>
          <div>
            <%= link_to title_for_node(node), node_path(node) %>
            <span class="field_hint"><%= link_to_path("#{node.unique_name} ↗", node.unique_name) %></span>
          </div>
          <span class="dashboard_widget_meta">
            <% if node.locked? %>
              <%= icon("lock", library: "tabler", "aria-label": t(".held_by")) %>
              <%= node.lock_owner.login %>,
            <% elsif (editor = node_last_editor(node)) %>
              <%= editor %>,
            <% end %>
            <%= relative_time_phrase(node.updated_at) %>
          </span>
        </li>
      <% end %>
    </ul>
    <%= link_to t(".see_all_drafts"), drafts_nodes_path %>
  </div>

  <div class="dashboard_widget">
    <h3><%= t("node_actions.heading") %></h3>
    <table id="node_action_list">
      <%= render partial: "node_actions/action_row", collection: @actions, as: :action %>
    </table>
    <%= link_to t(".see_all_changes"), admin_log_path %>
  </div>

</div>

<div id="dashboard_housekeeping">
  <h3><%= t(".housekeeping") %></h3>
  <div class="button_row">
    <%= link_to edit_user_path(current_user), class: "action_button" do %>
      <%= icon("user-cog", library: "tabler", "aria-hidden": true) %> <%= t(".my_account") %>
    <% end %>
    <%= link_to nodes_path, class: "action_button" do %>
      <%= icon("list", library: "tabler", "aria-hidden": true) %> <%= t("nodes.index.title") %>
    <% end %>
    <%= link_to events_path, class: "action_button" do %>
      <%= icon("calendar", library: "tabler", "aria-hidden": true) %> <%= t("events.index.title") %>
    <% end %>
    <%= link_to assets_path, class: "action_button" do %>
      <%= icon("folder", library: "tabler", "aria-hidden": true) %> <%= t("assets.index.title") %>
    <% end %>
    <% if current_user.is_admin? %>
      <%= link_to users_path, class: "action_button" do %>
        <%= icon("users", library: "tabler", "aria-hidden": true) %> <%= t("users.index.title") %>
      <% end %>
    <% end %>
    <% if current_user.redaktion? %>
      <%= link_to menu_items_path, class: "action_button" do %>
        <%= icon("menu-2", library: "tabler", "aria-hidden": true) %> <%= t(".navigation") %>
      <% end %>
    <% end %>
    <% trash_count = Node.trash.children.count %>
    <%= link_to trashed_nodes_path, class: "action_button" do %>
      <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= t("nodes.trashed.title") %><%= " (#{trash_count})" if trash_count > 0 %>
    <% end %>
  </div>
</div>