Aggiunge navigazione mobile dedicata e trasforma le principali liste operative in layout più leggibili e facili da toccare. Co-authored-by: Cursor <cursoragent@cursor.com>
84 lines
3.8 KiB
ERB
84 lines
3.8 KiB
ERB
<div class="space-y-6">
|
|
<div class="flex flex-wrap items-end justify-between gap-3">
|
|
<div>
|
|
<h1 class="text-xl font-semibold tracking-tight md:text-2xl">Utenti</h1>
|
|
<p class="mt-1 text-sm text-zinc-500">
|
|
<%= link_to "Impostazioni", admin_path, class: "hover:underline" %>
|
|
· account globali. Gli admin vedono tutti i progetti; gli utenti solo quelli abilitati.
|
|
</p>
|
|
</div>
|
|
<%= link_to "Nuovo utente", new_user_path, class: "#{btn_primary} w-full sm:w-auto" %>
|
|
</div>
|
|
|
|
<div class="<%= card_class %>">
|
|
<div class="divide-y divide-zinc-100 dark:divide-zinc-800 md:hidden">
|
|
<% @users.each do |user| %>
|
|
<div class="p-4 <%= "opacity-60" unless user.active? %>">
|
|
<div class="flex items-start justify-between gap-3">
|
|
<div class="min-w-0">
|
|
<div class="font-semibold"><%= user.full_name %><% if user == current_user %><span class="ml-1 text-xs font-normal text-zinc-400">(tu)</span><% end %></div>
|
|
<div class="mt-0.5 break-anywhere text-sm text-zinc-500"><%= user.email %></div>
|
|
</div>
|
|
<%= link_to "Modifica", edit_user_path(user), class: "text-sm text-zinc-700 hover:underline dark:text-zinc-300" %>
|
|
</div>
|
|
<div class="mt-2 text-sm text-zinc-600 dark:text-zinc-300"><%= user.admin? ? "Admin" : "Utente" %> · <%= user.active? ? "Attivo" : "Disabilitato" %></div>
|
|
<div class="mt-1 text-sm text-zinc-500">
|
|
<% if user.admin? %>
|
|
Tutti i progetti
|
|
<% else %>
|
|
<% names = user.user_projects.select(&:enabled?).filter_map { |up| up.project&.name } %>
|
|
<%= names.any? ? names.join(", ") : "—" %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="hidden md:block">
|
|
<div class="<%= table_wrap_class %>">
|
|
<table class="<%= table_class %>">
|
|
<thead class="border-b border-zinc-100 bg-zinc-50 text-left text-xs font-medium uppercase tracking-wide text-zinc-500 dark:border-zinc-800 dark:bg-zinc-800 dark:text-zinc-400">
|
|
<tr>
|
|
<th class="px-4 py-3">Nome</th>
|
|
<th class="px-4 py-3">Email</th>
|
|
<th class="px-4 py-3">Ruolo</th>
|
|
<th class="px-4 py-3">Stato</th>
|
|
<th class="px-4 py-3">Progetti</th>
|
|
<th class="px-4 py-3"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-zinc-100 dark:divide-zinc-800">
|
|
<% @users.each do |user| %>
|
|
<tr class="<%= "opacity-60" unless user.active? %>">
|
|
<td class="px-4 py-3 font-medium">
|
|
<%= user.full_name %>
|
|
<% if user == current_user %><span class="ml-1 text-xs font-normal text-zinc-400">(tu)</span><% end %>
|
|
</td>
|
|
<td class="px-4 py-3 text-zinc-600 dark:text-zinc-300"><%= user.email %></td>
|
|
<td class="px-4 py-3"><%= user.admin? ? "Admin" : "Utente" %></td>
|
|
<td class="px-4 py-3">
|
|
<% if user.active? %>
|
|
<span class="text-zinc-900 dark:text-zinc-100">Attivo</span>
|
|
<% else %>
|
|
<span class="text-rose-700">Disabilitato</span>
|
|
<% end %>
|
|
</td>
|
|
<td class="px-4 py-3 text-zinc-600 dark:text-zinc-300">
|
|
<% if user.admin? %>
|
|
Tutti
|
|
<% else %>
|
|
<% names = user.user_projects.select(&:enabled?).filter_map { |up| up.project&.name } %>
|
|
<%= names.any? ? names.join(", ") : "—" %>
|
|
<% end %>
|
|
</td>
|
|
<td class="px-4 py-3 text-right">
|
|
<%= link_to "Modifica", edit_user_path(user), class: "text-zinc-700 hover:underline dark:text-zinc-300" %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|