From 4175f26cc8b22ff5a07929fa2436c561022cccd2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 1 Aug 2026 17:52:46 +0200 Subject: tidy up user list, make otp flag more visible --- app/views/users/_user.html.erb | 133 ++++++++++++++++++++++++----------------- 1 file changed, 79 insertions(+), 54 deletions(-) (limited to 'app') 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 @@ <% users.each do |user| %> - <%= user.login %> - - <% if user.roles.any? %> - <%= user.role_labels.join(", ") %> + + <% if user.otp_enrolled? %> + " aria-label="<%= t(".otp_enrolled") %>"> + <%= icon("shield-check", library: "tabler", "aria-hidden": true) %> + + <% elsif user.otp_pending_secret.present? %> + " aria-label="<%= t(".otp_pending") %>"> + <%= icon("shield-half", library: "tabler", "aria-hidden": true) %> + <% else %> - <%= t(".no_roles") %> - <% end %> - - - <%= link_to user_path(user), "aria-label" => t("admin.common.show"), - title: t("admin.common.show") do %> - <%= icon("eye", library: "tabler", "aria-hidden": true) %> + " aria-label="<%= t(".otp_missing") %>"> + <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> + <% end %> + <%= user.login %> - - <% if current_user.admin? || current_user == user %> - <%= link_to edit_user_path(user), "aria-label" => t("admin.common.edit"), - title: t("admin.common.edit") do %> - <%= icon("edit", library: "tabler", "aria-hidden": true) %> + + <% if user.roles.any? %> + <% user.role_labels.each do |label| %> + <%= label %> <% end %> + <% else %> + <%= t(".no_roles") %> <% end %> - - <% if current_user.admin? && current_user != user %> - <% if user.alumni? %> - <%= button_to reactivate_user_path(user), method: :put, - form: { class: 'button_to state_changing' }, - "aria-label" => t(".reactivate"), title: t(".reactivate") do %> - <%= icon("user-check", library: "tabler", "aria-hidden": true) %> + +
+ + <%= link_to user_path(user), "aria-label" => t("admin.common.show"), + title: t("admin.common.show") do %> + <%= icon("eye", library: "tabler", "aria-hidden": true) %> <% end %> - <% else %> - <%= button_to deactivate_user_path(user), method: :put, - form: { data: { confirm: t(".confirm_deactivate", :login => user.login) }, - class: 'button_to destructive' }, - "aria-label" => t(".deactivate"), title: t(".deactivate") do %> - <%= icon("user-off", library: "tabler", "aria-hidden": true) %> + + + + <% if current_user.admin? || current_user == user %> + <%= link_to edit_user_path(user), "aria-label" => t("admin.common.edit"), + title: t("admin.common.edit") do %> + <%= icon("edit", library: "tabler", "aria-hidden": true) %> + <% end %> <% end %> - <% end %> - <% end %> - - - <% if current_user.redaktion? && !user.alumni? %> - <% if user.redaktion? %> - <% unless user == current_user %> - <%= button_to revoke_redaktion_user_path(user), method: :put, - form: { data: { confirm: t(".confirm_revoke_redaktion", :login => user.login) }, - class: 'button_to destructive' }, - "aria-label" => t(".revoke_redaktion"), title: t(".revoke_redaktion") do %> - <%= icon("user-minus", library: "tabler", "aria-hidden": true) %> + + + + <% if current_user.admin? && current_user != user %> + <% if user.alumni? %> + <%= button_to reactivate_user_path(user), method: :put, + form: { class: 'button_to state_changing' }, + "aria-label" => t(".reactivate"), title: t(".reactivate") do %> + <%= icon("user-check", library: "tabler", "aria-hidden": true) %> + <% end %> + <% else %> + <%= button_to deactivate_user_path(user), method: :put, + form: { data: { confirm: t(".confirm_deactivate", :login => user.login) }, + class: 'button_to destructive' }, + "aria-label" => t(".deactivate"), title: t(".deactivate") do %> + <%= icon("user-off", library: "tabler", "aria-hidden": true) %> + <% end %> <% end %> <% end %> - <% elsif user.otp_enrolled? %> - <%= button_to grant_redaktion_user_path(user), method: :put, - form: { data: { confirm: t(".confirm_grant_redaktion", :login => user.login) }, - class: 'button_to state_changing' }, - "aria-label" => t(".grant_redaktion"), title: t(".grant_redaktion") do %> - <%= icon("user-plus", library: "tabler", "aria-hidden": true) %> + + + + <% if current_user.redaktion? && !user.alumni? %> + <% if user.redaktion? %> + <% unless user == current_user %> + <%= button_to revoke_redaktion_user_path(user), method: :put, + form: { data: { confirm: t(".confirm_revoke_redaktion", :login => user.login) }, + class: 'button_to destructive' }, + "aria-label" => t(".revoke_redaktion"), title: t(".revoke_redaktion") do %> + <%= icon("user-minus", library: "tabler", "aria-hidden": true) %> + <% end %> + <% end %> + <% elsif user.otp_enrolled? %> + <%= button_to grant_redaktion_user_path(user), method: :put, + form: { data: { confirm: t(".confirm_grant_redaktion", :login => user.login) }, + class: 'button_to state_changing' }, + "aria-label" => t(".grant_redaktion"), title: t(".grant_redaktion") do %> + <%= icon("user-plus", library: "tabler", "aria-hidden": true) %> + <% end %> + <% else %> + + <% end %> <% end %> - <% else %> - " - aria-label="<%= t(".needs_otp") %>"> - <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> - - <% end %> - <% end %> + +
<% end %> -- cgit v1.3