Skip to content

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

2.2 KB
Raw Blame
{{ define "list-form" -}}
{{- $root := .Root -}}
{{- $submit := .Submit -}}
{{- $canSave := .CanSave -}}
<form method="post" @submit.prevent="{{ $submit }}">
	<div class="page-content content">
		<section class="card">
			<label data-field>
				{{ $root.L.T "globals.fields.name" }}
				<input name="name" maxlength="200" autofocus required x-model="form.name" />
			</label>

			<div data-field>
				<label for="list-type">{{ $root.L.T "globals.fields.type" }}</label>
				<select name="type" id="list-type" aria-describedby="list-type-hint" required x-model="form.type">
					<option value="private">{{ $root.L.T "globals.terms.private" }}</option>
					<option value="public">{{ $root.L.T "globals.terms.public" }}</option>
				</select>
				<small id="list-type-hint" data-hint>{{ $root.L.T "lists.typeHelp" }}</small>
			</div>

			<div data-field>
				<label for="list-optin">{{ $root.L.T "lists.optin" }}</label>
				<select name="optin" id="list-optin" aria-describedby="list-optin-hint" required x-model="form.optin">
					<option value="single">{{ $root.L.T "lists.optins.single" }}</option>
					<option value="double">{{ $root.L.T "lists.optins.double" }}</option>
				</select>
				<small id="list-optin-hint" data-hint>{{ $root.L.T "lists.optinHelp" }}</small>
			</div>

			<label data-field>
				{{ $root.L.T "globals.terms.tags" }}
				<ot-taginput x-model="form.tags"><input name="tags" placeholder="{{ $root.L.T "globals.terms.tags" }}" maxlength="50" /></ot-taginput>
			</label>

			<label data-field>
				{{ $root.L.T "globals.fields.description" }}
				<textarea name="description" maxlength="2000" x-model="form.description"></textarea>
			</label>

			<label data-field>
				<input type="checkbox" role="switch" x-model="isArchived" /> {{ $root.L.T "globals.terms.archived" }}
				<small data-hint>{{ $root.L.T "lists.archivedHelp" }}</small>
			</label>
		</section>
		<footer class="hstack justify-end mt-6">
			<div class="hstack gap-3 justify-end">
				{{- if $canSave }}
					<button type="submit" data-variant="primary" data-testid="btn-save" data-spinner="small" :disabled="isLoading('lists.save')" :aria-busy="isLoading('lists.save')">{{ $root.L.T "globals.buttons.save" }}</button>
				{{- end }}
			</div>
		</footer>
	</div>
</form>
{{- end }}