Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Restyle users table and ditch badges for user/list role names.

Kailash Nadh022467974238
diff --git a/static/admin/assets/css/style.css b/static/admin/assets/css/style.css
index 21f10b94..bcec0565 100644
--- a/static/admin/assets/css/style.css
+++ b/static/admin/assets/css/style.css
@@ -1358,6 +1358,17 @@ section.import {
/* Users & roles */
section.users {
+ .role-name {
+ align-items: center;
+ gap: var(--space-2);
+
+ .avatar span {
+ width: 20px;
+ height: 20px;
+ font-size: 10px;
+ }
+ }
+
td .badge {
margin-inline: var(--space-1);
}
diff --git a/static/admin/views/users.html b/static/admin/views/users.html
index d2ed45c3..6723c26d 100644
--- a/static/admin/views/users.html
+++ b/static/admin/views/users.html
@@ -59,8 +59,9 @@
<th width="5%"><input type="checkbox" aria-label="{{ .L.T "globals.buttons.toggleSelect" }}"></th>
{{- end }}
<th>{{ $d.Page.SortLink $base "username" (.L.T "users.username") }}</th>
- <th>{{ .L.Tc "users.role" 1 }}</th>
<th>{{ $d.Page.SortLink $base "email" (.L.T "subscribers.email") }}</th>
+ <th>{{ .L.Tc "users.userRole" 1 }}</th>
+ <th>{{ .L.Tc "users.listRole" 2 }}</th>
<th>{{ $d.Page.SortLink $base "created_at" (.L.T "globals.fields.createdAt") }}</th>
<th>{{ $d.Page.SortLink $base "loggedin_at" (.L.T "users.lastLogin") }}</th>
<th class="actions align-right"></th>
@@ -87,19 +88,23 @@
</div>
</div>
</td>
- <td>
- <div class="hstack gap-1">
- {{- if eq .UserRole.ID 1 }}
- <a href="{{ $base }}?user_role_id={{ .UserRole.ID }}" title="{{ $.L.T "globals.buttons.view" }} {{ .UserRole.Name }}">{{ Badge (list (Icon "star") .UserRole.Name) }}</a>
- {{- else }}
- <a href="{{ $base }}?user_role_id={{ .UserRole.ID }}" title="{{ $.L.T "globals.buttons.view" }} {{ .UserRole.Name }}">{{ Badge (list (Icon "user") .UserRole.Name) }}</a>
- {{- end }}
- {{- with .ListRole }}
- <a href="{{ $base }}?list_role_id={{ .ID }}" title="{{ $.L.T "globals.buttons.view" }} {{ .Name }}">{{ Badge (list (Icon "list") .Name) }}</a>
- {{- end }}
+ <td data-label="{{ $.L.T "subscribers.email" }}" class="text-light">{{ if .Email.Valid }}{{ .Email.String }}{{ else }}<span class="text-light">&mdash;</span>{{ end }}</td>
+ <td data-label="{{ $.L.Tc "users.userRole" 1 }}">
+ <div class="name-stack role-name">
+ {{ template "avatar" dict "Kind" "role" "Seed" (printf "%d" .UserRole.ID) "Name" .UserRole.Name }}
+ <a href="{{ $base }}?user_role_id={{ .UserRole.ID }}" class="unstyled" title="{{ $.L.T "globals.buttons.view" }} {{ .UserRole.Name }}">{{ .UserRole.Name }}</a>
</div>
</td>
- <td data-label="{{ $.L.T "subscribers.email" }}">{{ if .Email.Valid }}{{ .Email.String }}{{ else }}<span class="text-light">&mdash;</span>{{ end }}</td>
+ <td data-label="{{ $.L.Tc "users.listRole" 2 }}">
+ {{- with .ListRole }}
+ <div class="name-stack role-name">
+ {{ template "avatar" dict "Kind" "role" "Seed" (printf "%d" .ID) "Name" .Name }}
+ <a href="{{ $base }}?list_role_id={{ .ID }}" class="unstyled" title="{{ $.L.T "globals.buttons.view" }} {{ .Name }}">{{ .Name }}</a>
+ </div>
+ {{- else }}
+ <span class="text-light">&mdash;</span>
+ {{- end }}
+ </td>
<td class="date-stack" data-label="{{ $.L.T "globals.fields.createdAt" }}">{{ NiceDate .CreatedAt }}</td>
<td class="date-stack" data-label="{{ $.L.T "users.lastLogin" }}">{{ if .LoggedInAt.Valid }}{{ NiceDate .LoggedInAt }}{{ else }}<span class="text-light">&mdash;</span>{{ end }}</td>
<td class="actions align-right">
@@ -117,7 +122,7 @@
</td>
</tr>
{{- else }}
- {{ template "empty-state" 8 }}
+ {{ if $d.Can "users:manage" }}{{ template "empty-state" 8 }}{{ else }}{{ template "empty-state" 7 }}{{ end }}
{{- end }}
</tbody>
</table>