summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/views/users/_user.html.erb133
1 files changed, 79 insertions, 54 deletions
diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb
index c9b21f0a..26d6cab2 100644
--- a/app/views/users/_user.html.erb
+++ b/app/views/users/_user.html.erb
@@ -1,70 +1,95 @@
1<% users.each do |user| %> 1<% users.each do |user| %>
2<tr> 2<tr>
3 <td class="user_login"><%= user.login %></td> 3 <td class="user_login">
4 <td class="user_roles"> 4 <% if user.otp_enrolled? %>
5 <% if user.roles.any? %> 5 <span role="img" title="<%= t(".otp_enrolled") %>" aria-label="<%= t(".otp_enrolled") %>">
6 <%= user.role_labels.join(", ") %> 6 <%= icon("shield-check", library: "tabler", "aria-hidden": true) %>
7 </span>
8 <% elsif user.otp_pending_secret.present? %>
9 <span role="img" class="otp_missing" title="<%= t(".otp_pending") %>" aria-label="<%= t(".otp_pending") %>">
10 <%= icon("shield-half", library: "tabler", "aria-hidden": true) %>
11 </span>
7 <% else %> 12 <% else %>
8 <span class="field_hint"><%= t(".no_roles") %></span> 13 <span role="img" class="otp_missing" title="<%= t(".otp_missing") %>" aria-label="<%= t(".otp_missing") %>">
9 <% end %> 14 <%= icon("shield-off", library: "tabler", "aria-hidden": true) %>
10 </td> 15 </span>
11 <td class="user_action">
12 <%= link_to user_path(user), "aria-label" => t("admin.common.show"),
13 title: t("admin.common.show") do %>
14 <%= icon("eye", library: "tabler", "aria-hidden": true) %>
15 <% end %> 16 <% end %>
17 <%= user.login %>
16 </td> 18 </td>
17 <td class="user_action"> 19 <td class="user_roles">
18 <% if current_user.admin? || current_user == user %> 20 <% if user.roles.any? %>
19 <%= link_to edit_user_path(user), "aria-label" => t("admin.common.edit"), 21 <% user.role_labels.each do |label| %>
20 title: t("admin.common.edit") do %> 22 <span class="user_role"><%= label %></span>
21 <%= icon("edit", library: "tabler", "aria-hidden": true) %>
22 <% end %> 23 <% end %>
24 <% else %>
25 <span class="field_hint"><%= t(".no_roles") %></span>
23 <% end %> 26 <% end %>
24 </td> 27 </td>
25 <td class="user_action"> 28 <td class="user_actions">
26 <% if current_user.admin? && current_user != user %> 29 <div class="user_action_grid">
27 <% if user.alumni? %> 30 <span class="user_action">
28 <%= button_to reactivate_user_path(user), method: :put, 31 <%= link_to user_path(user), "aria-label" => t("admin.common.show"),
29 form: { class: 'button_to state_changing' }, 32 title: t("admin.common.show") do %>
30 "aria-label" => t(".reactivate"), title: t(".reactivate") do %> 33 <%= icon("eye", library: "tabler", "aria-hidden": true) %>
31 <%= icon("user-check", library: "tabler", "aria-hidden": true) %>
32 <% end %> 34 <% end %>
33 <% else %> 35 </span>
34 <%= button_to deactivate_user_path(user), method: :put, 36
35 form: { data: { confirm: t(".confirm_deactivate", :login => user.login) }, 37 <span class="user_action">
36 class: 'button_to destructive' }, 38 <% if current_user.admin? || current_user == user %>
37 "aria-label" => t(".deactivate"), title: t(".deactivate") do %> 39 <%= link_to edit_user_path(user), "aria-label" => t("admin.common.edit"),
38 <%= icon("user-off", library: "tabler", "aria-hidden": true) %> 40 title: t("admin.common.edit") do %>
41 <%= icon("edit", library: "tabler", "aria-hidden": true) %>
42 <% end %>
39 <% end %> 43 <% end %>
40 <% end %> 44 </span>
41 <% end %> 45
42 </td> 46 <span class="user_action">
43 <td class="user_action"> 47 <% if current_user.admin? && current_user != user %>
44 <% if current_user.redaktion? && !user.alumni? %> 48 <% if user.alumni? %>
45 <% if user.redaktion? %> 49 <%= button_to reactivate_user_path(user), method: :put,
46 <% unless user == current_user %> 50 form: { class: 'button_to state_changing' },
47 <%= button_to revoke_redaktion_user_path(user), method: :put, 51 "aria-label" => t(".reactivate"), title: t(".reactivate") do %>
48 form: { data: { confirm: t(".confirm_revoke_redaktion", :login => user.login) }, 52 <%= icon("user-check", library: "tabler", "aria-hidden": true) %>
49 class: 'button_to destructive' }, 53 <% end %>
50 "aria-label" => t(".revoke_redaktion"), title: t(".revoke_redaktion") do %> 54 <% else %>
51 <%= icon("user-minus", library: "tabler", "aria-hidden": true) %> 55 <%= button_to deactivate_user_path(user), method: :put,
56 form: { data: { confirm: t(".confirm_deactivate", :login => user.login) },
57 class: 'button_to destructive' },
58 "aria-label" => t(".deactivate"), title: t(".deactivate") do %>
59 <%= icon("user-off", library: "tabler", "aria-hidden": true) %>
60 <% end %>
52 <% end %> 61 <% end %>
53 <% end %> 62 <% end %>
54 <% elsif user.otp_enrolled? %> 63 </span>
55 <%= button_to grant_redaktion_user_path(user), method: :put, 64
56 form: { data: { confirm: t(".confirm_grant_redaktion", :login => user.login) }, 65 <span class="user_action">
57 class: 'button_to state_changing' }, 66 <% if current_user.redaktion? && !user.alumni? %>
58 "aria-label" => t(".grant_redaktion"), title: t(".grant_redaktion") do %> 67 <% if user.redaktion? %>
59 <%= icon("user-plus", library: "tabler", "aria-hidden": true) %> 68 <% unless user == current_user %>
69 <%= button_to revoke_redaktion_user_path(user), method: :put,
70 form: { data: { confirm: t(".confirm_revoke_redaktion", :login => user.login) },
71 class: 'button_to destructive' },
72 "aria-label" => t(".revoke_redaktion"), title: t(".revoke_redaktion") do %>
73 <%= icon("user-minus", library: "tabler", "aria-hidden": true) %>
74 <% end %>
75 <% end %>
76 <% elsif user.otp_enrolled? %>
77 <%= button_to grant_redaktion_user_path(user), method: :put,
78 form: { data: { confirm: t(".confirm_grant_redaktion", :login => user.login) },
79 class: 'button_to state_changing' },
80 "aria-label" => t(".grant_redaktion"), title: t(".grant_redaktion") do %>
81 <%= icon("user-plus", library: "tabler", "aria-hidden": true) %>
82 <% end %>
83 <% else %>
84 <button type="button" class="disabled_action" disabled
85 title="<%= t(".grant_redaktion_blocked") %>"
86 aria-label="<%= t(".grant_redaktion_blocked") %>">
87 <%= icon("user-plus", library: "tabler", "aria-hidden": true) %>
88 </button>
89 <% end %>
60 <% end %> 90 <% end %>
61 <% else %> 91 </span>
62 <span class="field_hint" title="<%= t(".needs_otp") %>" 92 </div>
63 aria-label="<%= t(".needs_otp") %>">
64 <%= icon("shield-off", library: "tabler", "aria-hidden": true) %>
65 </span>
66 <% end %>
67 <% end %>
68 </td> 93 </td>
69</tr> 94</tr>
70<% end %> 95<% end %>