Skip to content

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

2.4 KB
Raw Blame
{{ define "campaign-archive" -}}
{{- $root := .Root -}}
{{- $canManage := .CanManage -}}
{{- $canSend := .CanSend -}}
<div class="page-content content">
	<div class="row">
		<div class="col-6">
			<label data-field>
				<input type="checkbox" role="switch" x-model="form.archive" :disabled="!canArchive" /> {{ $root.L.T "campaigns.archiveEnable" }}
				<small data-hint>{{ $root.L.T "campaigns.archiveHelp" }}</small>
			</label>
		</div>
		{{ if and $canManage }}
		<template x-if="!canEdit && canArchive">
			<div class="col-6 col-end align-right">
					<button type="button" data-variant="primary" @click="onSaveArchive" :disabled="isLoading('campaigns')">{{ $root.L.T "globals.buttons.saveChanges" }}</button>
			</div>
		</template>
		{{ end }}
	</div>

	<template x-if="form.archive">
		<div>
			<fieldset class="card" :disabled="!canArchive">
				<legend>{{ $root.L.T "globals.terms.archive" }}</legend>

				<fieldset class="group">
					<legend class="mb-0">{{ $root.L.Tc "globals.terms.template" 1 }}</legend>
					<select x-model.number="form.archive_template_id" name="archive_template" :disabled="form.content_type === 'visual'" required>
						<template x-for="t in templatesFor('campaign')" :key="t.id">
							<option :value="t.id" x-text="t.name"></option>
						</template>
					</select>
					<button type="button" data-variant="primary" @click="onPreviewArchive">{{ $root.L.T "globals.buttons.preview" }}</button>
				</fieldset>

				<label data-field>
					{{ $root.L.T "globals.fields.slug" }}
					<input name="archive_slug" maxlength="200" x-model="form.archive_slug" />
					<small data-hint>{{ $root.L.T "campaigns.archiveSlugHelp" }}</small>
				</label>

				<a class="text-8" href="{{ $root.Data.ArchiveURL }}" target="_blank" rel="noopener noreferrer">{{ Icon "link-2" }} {{ $root.Data.ArchiveURL }}</a>
			</fieldset>

			<fieldset class="card" :disabled="!canArchive" data-field>
				<legend>{{ $root.L.T "campaigns.archiveMeta" }}</legend>
				<textarea name="archive_meta" x-model="form.archiveMetaStr" rows="15"></textarea>
				<small data-hint>{{ $root.L.T "campaigns.archiveMetaHelp" }}</small>
				<template x-if="form.archiveMetaStr === '' || form.archiveMetaStr === '{}'">
					<div class="mt-4"><button type="button" class="outline small" @click="onFillArchiveMeta">{{ $root.L.T "globals.buttons.setDefault" }}</button></div>
				</template>
			</fieldset>
		</div>
	</template>
</div>
{{- end }}