High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
Restyle subscriber table and make lists layout better.
Kailash Nadh8f135c559ac1
diff --git a/static/admin/assets/css/style.css b/static/admin/assets/css/style.cssindex 47c9f8f6..2843a059 100644--- a/static/admin/assets/css/style.css+++ b/static/admin/assets/css/style.css@@ -352,6 +352,23 @@ a:has(> .badge:only-child) {border: 1px solid var(--border);}+ .badge-avatar {+ gap: var(--space-1);+ white-space: nowrap;++ .avatar {+ display: inline-flex;+ margin: 0;++ img,+ span {+ height: 18px;+ width: 18px;+ font-size: 8px;+ }+ }+ }+a {display: inline-flex;align-items: center;@@ -1094,9 +1111,57 @@ section.lists {}/* Subscribers */+.subscribers td.email .lists {+ list-style-type: none;+ margin: 0;+ padding-inline-start: 0;++ li,+ > .name-stack {+ align-items: center;+ gap: 0.2rem;+ max-width: 16ch;+ font-size: var(--text-8);++ .avatar span {+ width: 16px;+ height: 16px;+ font-size: 0.7rem;+ text-align: center;+ }++ a {+ min-width: 0;+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ color: var(--muted-foreground);+ }+ }++}+.subscribers {- .list-names {- row-gap: var(--space-1);+ td.email .lists {+ margin-top: var(--space-1);++ .avatar .badge {+ margin: 0;+ padding: 0;++ .icon {+ margin: 0;+ }+ }++ > a {+ white-space: nowrap;+ }++ .status-icon {+ flex-shrink: 0;+ }}.blocklisted {@@ -1108,7 +1173,7 @@ section.lists {td {&.email {- width: 30%;+ width: 48%;}&.link-click-url {diff --git a/static/admin/partials/filter-badge.html b/static/admin/partials/filter-badge.htmlindex 8e019739..7010ee78 100644--- a/static/admin/partials/filter-badge.html+++ b/static/admin/partials/filter-badge.html@@ -1,5 +1,12 @@{{ define "filter-badge" -}}<span class="filter-tag">- {{ Badge .Label (default "" .Class) (default "" .Variant) }} <a href="{{ .URL }}" title="{{ L.T "globals.buttons.remove" }}" data-testid="btn-remove-filter">{{ Icon "x" }}</a>+ {{- if .LabelURL }}<a href="{{ .LabelURL }}" class="unstyled">{{ end }}+ {{- if .Avatar }}+ <span class="badge badge-avatar {{ default "" .Class }}"{{ if .Variant }} data-variant="{{ .Variant }}"{{ end }}>{{ template "avatar" .Avatar }} {{ .Label }}</span>+ {{- else }}+ {{ Badge .Label (default "" .Class) (default "" .Variant) }}+ {{- end }}+ {{- if .LabelURL }}</a>{{ end }}+ <a href="{{ .URL }}" title="{{ L.T "globals.buttons.remove" }}" data-testid="btn-remove-filter">{{ Icon "x" }}</a></span>{{- end }}diff --git a/static/admin/views/lists.html b/static/admin/views/lists.htmlindex 8bd0fc9d..6398a6a9 100644--- a/static/admin/views/lists.html+++ b/static/admin/views/lists.html@@ -117,7 +117,7 @@{{- $count := index $counts . -}}{{- $label := $.L.T (printf "subscribers.status.%s" .) -}}{{- $percent := mulf (divf $count $total) 100 -}}- {{- $title := printf "%s %s (%.2f%%)" $label (FormatNumber $count) $percent -}}+ {{- $title := printf "%s %s (%.0f%%)" $label (FormatNumber $count) $percent -}}{{- $stats = append $stats (dict "Status" . "Count" $count "Label" $label "Percent" $percent "Title" $title) -}}{{- end }}<div class="subscriber-breakdown">@@ -128,7 +128,7 @@</div><div class="subscriber-legend text-8">{{- range $stats }}- <a class="unstyled text-grey" href="{{ URI "/admin/subscribers/lists" }}/{{ $listID }}?subscription_status={{ .Status }}" title="{{ .Title }}" aria-label="{{ .Title }}"><span class="status-icon status-{{ .Status }}" aria-hidden="true">{{ if eq .Status "unconfirmed" }}?{{ else }}{{ Icon (index $statusIcons .Status) }}{{ end }}</span> {{ printf "%.2f%%" .Percent }}</a>+ <a class="unstyled text-grey" href="{{ URI "/admin/subscribers/lists" }}/{{ $listID }}?subscription_status={{ .Status }}" title="{{ .Title }}" aria-label="{{ .Title }}"><span class="status-icon status-{{ .Status }}" aria-hidden="true">{{ if eq .Status "unconfirmed" }}?{{ else }}{{ Icon (index $statusIcons .Status) }}{{ end }}</span> {{ printf "%.0f%%" .Percent }}</a>{{- end }}</div></div>diff --git a/static/admin/views/subscribers.html b/static/admin/views/subscribers.htmlindex 7c4a44d4..af6c0492 100644--- a/static/admin/views/subscribers.html+++ b/static/admin/views/subscribers.html@@ -23,7 +23,7 @@<h1 class="page-title">{{ .L.T "globals.terms.subscribers" }}<span>({{ $d.Page.Total }})</span>- {{- if $d.CurrentList }} {{ template "filter-badge" dict "Label" $d.CurrentList.Name "URL" (URI "/admin/subscribers") }}{{ end }}+ {{- if $d.CurrentList }} {{ template "filter-badge" dict "Label" $d.CurrentList.Name "LabelURL" (printf "%s/%d" (URI "/admin/lists") $d.CurrentList.ID) "Avatar" (dict "Kind" "list" "Seed" (printf "%d" $d.CurrentList.ID) "Name" $d.CurrentList.Name) "URL" (URI "/admin/subscribers") }}{{ end }}{{- if eq $subStatus "none" }} {{ template "filter-badge" dict "Label" (.L.T "dashboard.orphanSubs") "URL" ($d.Page.FilterURL $base "subscription_status") }}{{- else if $subStatus }} {{ template "filter-badge" dict "Label" (list (Dot) (.L.T (printf "subscribers.status.%s" $subStatus))) "Class" (printf "status-%s" $subStatus) "URL" ($d.Page.FilterURL $base "subscription_status") }}{{ end }}{{- if $status }} {{ template "filter-badge" dict "Label" (list (Dot) (.L.T (printf "subscribers.status.%s" $status))) "Class" (printf "status-%s" $status) "URL" ($d.Page.FilterURL $base "status") }}{{ end }}@@ -90,8 +90,8 @@<thead><tr><th width="5%"><input type="checkbox" aria-label="{{ .L.T "globals.buttons.toggleSelect" }}"></th>- <th width="28%">{{ $d.Page.SortLink $base "email" (.L.T "subscribers.email") }}</th>- <th width="28%">{{ $d.Page.SortLink $base "name" (.L.T "globals.fields.name") }}</th>+ <th width="48%">{{ $d.Page.SortLink $base "email" (.L.T "subscribers.email") }}</th>+ <th width="18%">{{ $d.Page.SortLink $base "name" (.L.T "globals.fields.name") }}</th><th>{{ $d.Page.SortLink $base "created_at" (.L.T "globals.fields.createdAt") }}</th><th>{{ $d.Page.SortLink $base "updated_at" (.L.T "globals.fields.updatedAt") }}</th><th class="align-right"></th>@@ -102,7 +102,7 @@{{- $sub := . }}<tr data-testid="sub-row" data-id="{{ .ID }}" {{ if eq .Status "blocklisted" }}class="blocklisted"{{ end }}><td><input name="id" type="checkbox" value="{{ .ID }}"></td>- <td class="email">+ <td class="email"><div class="name-stack">{{ template "avatar" dict "Kind" "subscriber" "Seed" (printf "%d" .ID) "Name" (or .Name .Email) }}<div>@@ -111,31 +111,26 @@{{- $label := $.L.T (printf "subscribers.status.%s" .Status) }}<a href="{{ $base }}?status={{ .Status }}" class="status-icon status-{{ .Status }}" title="{{ $.L.T "globals.buttons.filter" }} {{ $label }}" aria-label="{{ $.L.T "globals.buttons.filter" }} {{ $label }}">{{ Icon (or (index $statusIcons .Status) "help-circle") }}</a>{{- end }}- {{- if .ParsedLists }}- <div class="mt-2">- <div class="hstack list-names">- {{- range $i, $l := .ParsedLists }}- {{- if lt $i 2 }}- <span>- <a class="unstyled text-light" href="{{ URI "/admin/subscribers/lists" }}/{{ $l.ID }}" title="{{ $.L.T "globals.buttons.filter" }} {{ $l.Name }}">{{ $l.Name }}- {{- if or (eq $l.Optin "double") (eq $l.SubscriptionStatus "unsubscribed") }}- {{- $label := $.L.T (printf "subscribers.status.%s" $l.SubscriptionStatus) }}- <span class="status-icon status-{{ $l.SubscriptionStatus }}" title="{{ $label }}" aria-label="{{ $label }}">{{ if eq $l.SubscriptionStatus "unconfirmed" }}?{{ else }}{{ Icon (or (index $statusIcons $l.SubscriptionStatus) "help-circle") }}{{ end }}</span>- {{- end }}- </a>- </span>- {{- end }}+ <div class="hstack lists">+ {{- range $i, $l := .ParsedLists }}+ {{- if lt $i 3 }}+ <div class="name-stack">+ {{- $label := $.L.T (printf "subscribers.status.%s" $l.SubscriptionStatus) }}+ <a class="unstyled avatar avatar-list" href="{{ URI "/admin/subscribers" }}/{{ $sub.ID }}/lists" title="{{ $label }}" aria-label="{{ $l.Name }}: {{ $label }}"><span class="badge enum status-{{ $l.SubscriptionStatus }}" aria-hidden="true">{{ if eq $l.SubscriptionStatus "unconfirmed" }}?{{ else }}{{ Icon (or (index $statusIcons $l.SubscriptionStatus) "help-circle") }}{{ end }}</span></a>+ <a class="unstyled" href="{{ URI "/admin/subscribers/lists" }}/{{ $l.ID }}" title="{{ $.L.T "globals.buttons.filter" }} {{ $l.Name }}">{{ $l.Name }}</a>+ </div>{{- end }}- </div>- {{- if gt (len .ParsedLists) 2 }}- <a href="{{ URI "/admin/subscribers" }}/{{ $sub.ID }}/lists" title="{{ range $i, $l := slice .ParsedLists 2 }}{{ if $i }}, {{ end }}{{ $l.Name }}{{ end }}">+{{ sub (len .ParsedLists) 2 }} {{ lower ($.L.T "globals.terms.lists") }}</a>- {{- end }}- </div>- {{- end }}+ {{- end }}+ {{- if gt (len .ParsedLists) 3 }}+ <a href="{{ URI "/admin/subscribers" }}/{{ $sub.ID }}/lists" title="{{ range $i, $l := slice .ParsedLists 3 }}{{ if $i }}, {{ end }}{{ $l.Name }}{{ end }}">+{{ sub (len .ParsedLists) 3 }} {{ lower ($.L.T "globals.terms.lists") }}</a>+ {{- end }}+ </div></div></div></td>- <td data-label="{{ $.L.T "globals.fields.name" }}"><a class="unstyled" href="{{ URI "/admin/subscribers" }}/{{ .ID }}">{{ .Name }}</a></td>+ <td class="name" data-label="{{ $.L.T "globals.fields.name" }}">+ <a class="unstyled" href="{{ URI "/admin/subscribers" }}/{{ .ID }}">{{ .Name }}</a>+ </td><td data-label="{{ $.L.T "globals.fields.createdAt" }}">{{ NiceDate .CreatedAt }}</td><td data-label="{{ $.L.T "globals.fields.updatedAt" }}">{{ NiceDate .UpdatedAt }}</td><td class="actions align-right">@@ -144,9 +139,17 @@{{ Icon "more-vertical" }}</button><menu popover id="sub-actions-{{ .ID }}">- <a href="{{ URI "/api/subscribers" }}/{{ .ID }}/export" role="menuitem" class="button ghost" data-testid="btn-download">{{ Icon "download-cloud" }} {{ $.L.T "subscribers.downloadData" }}</a>{{- if $d.Can "subscribers:manage" }}- <a href="{{ URI "/admin/subscribers" }}/{{ .ID }}" role="menuitem" class="button ghost" data-testid="btn-edit">{{ Icon "edit-2" }} {{ $.L.T "globals.buttons.edit" }}</a>+ <a href="{{ URI "/admin/subscribers" }}/{{ .ID }}" role="menuitem" class="button ghost" data-testid="btn-edit">{{ Icon "edit-2" }} {{ $.L.T "globals.buttons.edit" }}</a>+ {{- end }}+ <hr />+ <a href="{{ URI "/admin/subscribers" }}/{{ .ID }}/lists" role="menuitem" class="button ghost">{{ Icon "list" }} {{ $.L.Tc "globals.terms.lists" 2 }}</a>+ <a href="{{ URI "/admin/subscribers" }}/{{ .ID }}/activity" role="menuitem" class="button ghost">{{ Icon "activity" }} {{ $.L.T "subscribers.activity" }}</a>+ {{- if $d.Can "bounces:get" }}+ <a href="{{ URI "/admin/subscribers" }}/{{ .ID }}/bounces" role="menuitem" class="button ghost">{{ Icon "corner-right-down" }} {{ $.L.T "globals.terms.bounces" }}</a>+ {{- end }}+ {{- if $d.Can "subscribers:manage" }}+ <a href="{{ URI "/api/subscribers" }}/{{ .ID }}/export" role="menuitem" class="button ghost" data-testid="btn-download">{{ Icon "download-cloud" }} {{ $.L.T "subscribers.downloadData" }}</a><hr /><button type="button" role="menuitem" class="ghost" data-variant="danger" data-testid="btn-delete" :disabled="isLoading('subscribers')" @click.prevent="onDeleteSubscriber({{ .ID }}, {{ ToJSON .Email }})">{{ Icon "trash-2" }} {{ $.L.T "globals.buttons.delete" }}</button>{{- end }}@@ -155,7 +158,7 @@</td></tr>{{- else }}- {{ template "empty-state" 6 }}+ {{ template "empty-state" 7 }}{{- end }}</tbody></table>