41 lines
1.6 KiB
HTML
41 lines
1.6 KiB
HTML
{{ $slug := ((.Context).Value "params").Slug }}
|
|
{{ $page := ((.Context).Value "adapter").GetPage $slug }}
|
|
{{ $editableSlugs := ((.Context).Value "adapter").EditableSlugs }}
|
|
{{ $csrfToken := (.Context).Value "csrfToken" }}
|
|
{{ $noEmpty := .FormValue "no-empty" }}
|
|
|
|
{{ template "header" . }}
|
|
|
|
<h2>Edit Page</h2>
|
|
|
|
<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}}"/>
|
|
{{ if $editableSlugs }}
|
|
<label for="slug">Slug</label><br/>
|
|
<input class="slug-input" id="slug" type="text" name="slug" value="{{$slug}}" required/><br/>
|
|
{{ end }}
|
|
<label for="title">Title</label><br/>
|
|
<input class="title-input" id="title" type="text" name="title" value="{{($page).Title}}" required/><br/>
|
|
<span class="edited-time">last edited {{($page).Edited.Format "2006-01-02 15:04"}}</span><br/>
|
|
<label for="content">Content</label><br/>
|
|
<textarea class="content-input" id="content" name="content" required>{{($page).Content}}</textarea><br/>
|
|
<input type="submit" value="Save"/>
|
|
</form>
|
|
|
|
<details class="danger-zone"><summary>Danger Zone</summary>
|
|
<form class="eraser" method="POST" action="/delete/{{$slug}}">
|
|
<input hidden name="csrfToken" value="{{$csrfToken}}"/>
|
|
<label>I want to delete this page
|
|
<input type="checkbox" required/>
|
|
</label><br/>
|
|
<label>Yes, I'm sure
|
|
<input type="checkbox" required/>
|
|
</label><br/>
|
|
<input type="submit" value="DELETE"/>
|
|
</form>
|
|
</details>
|
|
{{ template "footer" . }}
|