camper/web/templates/admin/page/form.gohtml

67 lines
2.3 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "head" -}}
<link rel="stylesheet" media="screen" href="/static/isolated-block-editor@2.26.0.css"/>
<link rel="stylesheet" media="screen" href="/static/isolated-block-editor-core@2.26.0.css"/>
<script src="/static/react@18.2.0.min.js"></script>
<script src="/static/react-dom@18.2.0.min.js"></script>
<script src="/static/isolated-block-editor@2.26.0.min.js"></script>
{{- end }}
{{ define "title" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/page.pageForm*/ -}}
{{ if .Slug}}
{{( pgettext "Edit Page" "title" )}}
{{ else }}
{{( pgettext "New Page" "title" )}}
{{ end }}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/page.pageForm*/ -}}
<form
{{ if .Slug }}
data-hx-put="/admin/pages/{{ .Slug }}"
{{ else }}
action="/admin/pages" method="post"
{{ end }}
>
<h2>
{{ if .Slug }}
{{( pgettext "Edit Page" "title" )}}
{{ else }}
{{( pgettext "New Page" "title" )}}
{{ end }}
</h2>
{{ CSRFInput }}
<fieldset>
{{ with .Title -}}
<label>
{{( pgettext "Title" "input")}}<br>
<input type="text" name="{{ .Name }}" value="{{ .Val }}"
required {{ template "error-attrs" . }}><br>
</label>
{{ template "error-message" . }}
{{- end }}
{{ with .Content -}}
<label>
{{( pgettext "Content" "input")}}<br>
<textarea class="html" name="{{ .Name }}" {{ template "error-attrs" . }}>{{ .Val }}</textarea><br>
{{ template "error-message" . }}
</label>
{{- end }}
</fieldset>
<footer>
<button type="submit">
{{ if .Slug }}
{{( pgettext "Update" "action" )}}
{{ else }}
{{( pgettext "Add" "action" )}}
{{ end }}
</button>
</footer>
</form>
{{- end }}