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 "media-gallery" -}}
{{- $root := .Root -}}
{{- $d := $root.Data -}}
{{- $mode := .Mode -}}
{{- $picker := eq .Mode "picker" -}}
{{- $canManage := $d.Can "media:manage" -}}
<section class="media-files" x-data="mediaView({{ if $picker }}'picker'{{ else }}'manage'{{ end }})">
<header class="row page-header">
<div class="col-4">
<div class="hstack">
<h1 class="page-title">
{{ $root.L.T "globals.terms.media" }}
<span>({{ $d.Page.Total }})</span>
</h1>
{{- if $d.Provider }}<div class="text-lighter">{{ $d.Provider }}</div>{{ end }}
</div>
</div>
<div class="col-8 hstack justify-end buttons">
<form method="get" action="{{ URI "/admin/campaigns/media" }}{{ if $picker }}/fragment{{ end }}" class="search-form">
{{- $d.Page.FormFields "query" -}}
<fieldset class="group">
<input name="query" aria-label="{{ $root.L.T "globals.buttons.search" }}" placeholder="{{ $root.L.T "globals.buttons.search" }}" value="{{ $d.Page.Query }}" autofocus />
<button type="submit" class="outline external" aria-label="{{ $root.L.T "globals.buttons.search" }}">{{ Icon "search" }}</button>
</fieldset>
</form>
{{- if $canManage }}
<ot-dropdown>
<button type="button" data-variant="primary" class="btn-new media-upload-btn" popovertarget="media-upload">
{{ Icon "upload" }} {{ $root.L.T "globals.buttons.upload" }}
</button>
<div popover id="media-upload" class="media-upload">
<form @submit.prevent="onUpload">
<div data-field>
<ot-upload>
<div data-field class="vstack">
<input type="file" name="file" multiple hidden @change="files = [...$event.target.files]" />
<button type="button" class="ghost" aria-label="{{ $root.L.T "globals.buttons.upload" }}">{{ Icon "upload" }}</button>
<div data-files><small data-hint>{{ $root.L.T "media.uploadHelp" }}</small></div>
</div>
</ot-upload>
</div>
<div class="hstack justify-end buttons">
<button type="submit" data-variant="primary" data-spinner="small" :disabled="files.length === 0 || isUploading" :aria-busy="isUploading">
{{ Icon "upload" }} {{ $root.L.T "globals.buttons.upload" }}
</button>
</div>
</form>
</div>
</ot-dropdown>
{{- end }}
</div>
</header>
<div class="card page-content">
{{- if $d.Media }}
<ul class="unstyled gallery">
{{- range $d.Media }}
<li>
{{- template "media-gallery-item" dict "Root" $root "Mode" $mode "CanManage" $canManage "Media" . }}
</li>
{{- end }}
</ul>
{{- else }}
{{- template "empty-state" }}
{{- end }}
{{- template "pagination" $d.Page.Pagination }}
</div>
</section>
{{- end }}