From 464dd4266bdc433805010b5dca428f4cb75c2a81 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 31 Jul 2026 15:55:43 +0200 Subject: Group user accounts by role Replaces the two-way admin/user split with four groups ordered by capability: administration, Redaktion, editors, alumni. alumni takes precedence over capability in role_group, so a retired admin appears at the bottom rather than the top. Forms now offer the three roles as checkboxes rather than a single admin checkbox, with a trailing hidden blank so an empty set can be posted, and user_params permits roles only for admins. Three create buttons prefill the common combinations. --- app/views/users/index.html.erb | 55 +++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'app/views/users/index.html.erb') diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 0a003cb1..854811a2 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,27 +1,32 @@ -

<%= t(".admins") %>

-<%= link_to new_user_path(admin: true), class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_admin") %> -<% end %> - - - - - - - - <%= render :partial => "user", :locals => {:users => @users[:admin] ||= []} %> -
<%= t("users.labels.login") %>
+

<%= t(".title") %>

+ +

+ <% UsersController::ROLE_PRESETS.each_key do |preset| %> + <%= link_to new_user_path(:preset => preset), class: 'action_button' do %> + <%= icon("plus", library: "tabler", "aria-hidden": true) %> + <%= t(".create_#{preset}") %> + <% end %> + <% end %> +

-

<%= t(".users") %>

-<%= link_to new_user_path, class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_user") %> +<% UsersController::GROUP_ORDER.each do |group| %> + <% members = @users[group] || [] %> +

"> + <%= t(".group_#{group}") %> + <%= members.size %> +

+ <% if members.any? %> + "> + + + + + + + + <%= render :partial => "user", :locals => { :users => members } %> +
<%= t("users.labels.login") %><%= t("users.labels.roles") %>
+ <% else %> +

<%= t(".group_empty") %>

+ <% end %> <% end %> - - - - - - - - <%= render :partial => "user", :locals => {:users => @users[:user] ||= []} %> -
<%= t("users.labels.login") %>
-- cgit v1.3