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
{{ define "bounces-table" -}}
{{- $page := .Page -}}
{{- $root := .Root -}}
{{- with $root -}}
{{- $d := .Data -}}
{{- $base := URI "/admin/subscribers/bounces" -}}
<div class="bounces" x-data="bouncesView">
<div class="card page-content has-table">
<div class="table-wrapper" x-data="table({ query: {{ if $page }}{{ ToJSON $page.Query }}{{ else }}{{ ToJSON "" }}{{ end }}, filters: {{ if $page }}{{ ToJSON $page.QueryParams }}{{ else }}{}{{ end }}, total: {{ if $page }}{{ $page.Total }}{{ else }}{{ len $d.Bounces }}{{ end }} })" :aria-busy="isLoading('bounces')" @change="onChange($event)">
<template x-if="numSelected > 0">
<ot-dropdown class="bulk-actions" data-variant="primary">
<button popovertarget="bounce-bulk-actions" type="button" class="small" data-testid="btn-bulk-actions">
<span x-text="numSelectedLabel"></span> {{ Icon "more-vertical" }}
</button>
<menu popover id="bounce-bulk-actions">
{{- if and $page (gt $page.Total $page.PerPage) }}
<button type="button" role="menuitem" class="ghost" data-testid="select-all-bounces" x-cloak x-show="!allSelected" @click.prevent="onSelectAllQuery()">
{{ Icon "list" }} <span x-text="selectAllLabel"></span>
</button>
{{- end }}
{{- if $d.Can "bounces:manage" }}
<button type="button" role="menuitem" class="ghost" data-testid="btn-manage-blocklist" @click.prevent="onBlocklistSelected(allSelected, total, selectedQueryParams().toString())">{{ Icon "user-x" }} {{ .L.T "globals.terms.blocklist" }}</button>
<hr />
<button type="button" role="menuitem" class="ghost" data-variant="danger" data-testid="btn-delete-bounces" :disabled="isLoading('bounces')" @click.prevent="onDeleteSelected(numSelected, selectedQueryParams().toString())">{{ Icon "trash-2" }} {{ .L.T "globals.buttons.delete" }} <span x-text="numSelected"></span></button>
{{- end }}
</menu>
</ot-dropdown>
</template>
<table class="has-select">
<thead>
<tr>
<th width="5%"><input type="checkbox" aria-label="{{ .L.T "globals.buttons.toggleSelect" }}"></th>
<th>{{ if $page }}{{ $page.SortLink $base "email" (.L.T "globals.fields.email") }}{{ else }}{{ .L.T "globals.fields.email" }}{{ end }}</th>
<th>{{ .L.T "globals.terms.campaign" }}</th>
<th>{{ if $page }}{{ $page.SortLink $base "source" (.L.T "globals.fields.source") }}{{ else }}{{ .L.T "globals.fields.source" }}{{ end }}</th>
<th>{{ if $page }}{{ $page.SortLink $base "type" (.L.T "globals.fields.type") }}{{ else }}{{ .L.T "globals.fields.type" }}{{ end }}</th>
<th>{{ if $page }}{{ $page.SortLink $base "created_at" (.L.T "globals.fields.createdAt") }}{{ else }}{{ .L.T "globals.fields.createdAt" }}{{ end }}</th>
<th class="align-right"></th>
</tr>
</thead>
<tbody>
{{- range $d.Bounces }}
<tr data-testid="bounce-row" data-id="{{ .ID }}">
<td><input name="id" type="checkbox" value="{{ .ID }}" data-subscriber-id="{{ .SubscriberID }}"></td>
<td>
<div class="avatar{{ if eq .SubscriberStatus "blocklisted" }} disabled{{ end }}">
{{ template "avatar-icon" dict "Kind" "subscriber" "Name" (or .SubscriberName .Email) "Href" (printf "%s/%d" (URI "/admin/subscribers") .SubscriberID) "Title" (printf "%s %s" ($root.L.T "globals.buttons.view") (or .SubscriberName .Email)) }}
<div class="avatar-label">
<a href="{{ URI "/admin/subscribers" }}/{{ .SubscriberID }}" class="unstyled{{ if eq .SubscriberStatus "blocklisted" }} blocklisted{{ end }}">{{ .Email }}</a>
{{ if ne .SubscriberStatus "enabled" }}{{ Badge (list (Dot) ($root.L.T (printf "globals.terms.%s" .SubscriberStatus))) (printf "status-%s" .SubscriberStatus) }}{{ end }}
<div class="text-8 text-light">{{ .SubscriberName }}</div>
</div>
</div>
</td>
<td data-label="{{ $root.L.T "globals.terms.campaign" }}">
{{- with .Campaigns }}
<div class="avatar">
{{ template "avatar-icon" dict "Kind" "campaign" "Name" .Name "Href" (printf "%s/%d" (URI "/admin/campaigns") .ID) "Title" (printf "%s %s" ($root.L.T "globals.buttons.view") .Name) }}
<a href="{{ $base }}?campaign_id={{ .ID }}" class="avatar-label unstyled" title="{{ $root.L.T "globals.buttons.filter" }} {{ .Name }}">{{ .Name }}</a>
</div>
{{- else }}-{{ end }}
</td>
<td data-label="{{ $root.L.T "globals.fields.source" }}"><a href="{{ $base }}?source={{ .Source }}" class="unstyled text-light" title="{{ $root.L.T "globals.buttons.filter" }} {{ .Source }}">{{ .Source }}</a></td>
<td data-label="{{ $root.L.T "globals.fields.type" }}"><a href="{{ $base }}?type={{ .Type }}" class="unstyled" title="{{ $root.L.T "globals.buttons.filter" }} {{ $root.L.T (printf "bounces.%s" .Type) }}">{{ Badge ($root.L.T (printf "bounces.%s" .Type)) (printf "enum bounce-%s" .Type) }}</a></td>
<td class="date-stack" data-label="{{ $root.L.T "globals.fields.createdAt" }}">{{ NiceDate .CreatedAt }}</td>
<td class="actions align-right">
<ot-dropdown>
<button popovertarget="bounce-actions-{{ .ID }}" type="button" class="ghost more icon" aria-label="{{ $root.L.T "globals.buttons.more" }}">
{{ Icon "more-vertical" }}
</button>
<menu popover id="bounce-actions-{{ .ID }}">
<button type="button" role="menuitem" class="ghost" data-testid="btn-meta" @click.prevent="onView({{ ToJSON .Email }}, {{ ToJSON .Meta }})">{{ Icon "file-text" }} {{ $root.L.T "globals.buttons.view" }}</button>
{{- if $d.Can "bounces:manage" }}
<button type="button" role="menuitem" class="ghost" data-variant="danger" data-testid="btn-delete" :disabled="isLoading('bounces')" @click.prevent="onDeleteBounce({{ .ID }}, {{ ToJSON .Email }})">{{ Icon "trash-2" }} {{ $root.L.T "globals.buttons.delete" }}</button>
{{- end }}
</menu>
</ot-dropdown>
</td>
</tr>
{{- else }}
{{ template "empty-state" 7 }}
{{- end }}
</tbody>
</table>
{{- if $page }}{{ template "pagination" $page.Pagination }}{{ end }}
</div>
</div>
<dialog x-ref="metaDialog">
<div class="dialog-card content">
<header class="dialog-head"><h4 class="dialog-title" x-text="metaTitle"></h4></header>
<section class="dialog-body">
<pre x-text="JSON.stringify(meta, null, 2)"></pre>
</section>
<footer class="dialog-foot hstack justify-end">
<button type="button" class="outline" @click="$refs.metaDialog.close()">{{ .L.T "globals.buttons.close" }}</button>
</footer>
</div>
</dialog>
</div>
<script type="module" src="{{ URI "/admin/static/js/views/bounces.js" }}?v={{ .AssetVersion }}" defer></script>
{{- end }}
{{- end }}