nirvash/templates/cms_edit.html

24 lines
1 KiB
HTML
Raw Normal View History

2022-06-03 04:56:38 +00:00
{{ $slug := ((.Context).Value "params").Slug }}
{{ $page := ((.Context).Value "adapter").GetPage $slug }}
2022-06-05 04:34:20 +00:00
{{ $editableSlugs := ((.Context).Value "adapter").EditableSlugs }}
{{ $csrfToken := (.Context).Value "csrfToken" }}
{{ $noEmpty := .FormValue "no-empty" }}
2022-06-03 04:56:38 +00:00
{{ template "header" . }}
2022-06-05 04:34:20 +00:00
<a href="/">&laquo;</a>
<form class="editor" method="POST" action="/save/{{$slug}}">
{{ if $noEmpty }}
<span class="edit-error">Empty fields are not allowed - please try again</span><br/>
{{ end }}
<input hidden name="csrfToken" value="{{$csrfToken}}"/>
<input hidden name="oldSlug" value="{{$slug}}"/>
2022-06-05 04:34:20 +00:00
{{ if $editableSlugs }}
<input class="slug-input" type="text" name="slug" value="{{$slug}}"/><br/>
2022-06-05 04:34:20 +00:00
{{ end }}
<input class="title-input" type="text" name="title" value="{{($page).Title}}"/><br/>
<span class="edited-time">last edited {{($page).Edited}}</span><br/>
<textarea class="content-input" name="content">{{($page).Content}}</textarea><br/>
2022-06-05 04:34:20 +00:00
<input type="submit" value="Save"/>
2022-06-03 04:56:38 +00:00
</form>
{{ template "footer" . }}