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

67 lines
2.2 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/grapesjs@0.21.4.min.css">
<script src="/static/grapesjs@0.21.4.min.js"></script>
<script src="/static/grapesjs-plugin-ckeditor@1.0.1.min.js"></script>
<script src="/static/grapesjs-blocks-basic@1.0.2.min.js"></script>
<script src="/static/grapesjs-preset-webpage@1.0.3.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 }}