Refactored user roles

This commit is contained in:
2024-09-23 12:32:45 +02:00
parent 0f877456a4
commit 084613bbf5
3 changed files with 26 additions and 30 deletions

View File

@@ -25,7 +25,7 @@
</td>
<td class="p-2 py-3 text-nowrap">
<span class="inline-flex -space-x-px overflow-hidden rounded-md bg-white shadow divide-x divide-gray-300">
<% User::AVAILABLE_ROLES.each do |role| %>
<% User.roles.keys.each do |role| %>
<% if allowed_to? :change_role?, user %>
<% if user.role == role.to_s %>
<%= button_to role, admin_user_path(user), method: :patch, params: { user: { role: role }}, form_class: "inline", class: "inline-block px-4 py-2 text-sm uppercase font-medium focus:relative bg-role-#{role}-light text-#{role}" %>