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 }}
|
2022-06-06 05:29:39 +00:00
|
|
|
{{ $csrfToken := (.Context).Value "csrfToken" }}
|
|
|
|
{{ $noEmpty := .FormValue "no-empty" }}
|
2022-06-03 04:56:38 +00:00
|
|
|
|
|
|
|
{{ template "header" . }}
|
2022-06-07 06:59:41 +00:00
|
|
|
|
2022-06-09 05:13:09 +00:00
|
|
|
{{ if ($page).Error }}
|
|
|
|
<h2>Page Error</h2>
|
|
|
|
|
|
|
|
<span class="adapter-error">{{($page).Error}}</span>
|
|
|
|
{{ else }}
|
|
|
|
|
2022-06-07 06:59:41 +00:00
|
|
|
<h2>Edit Page</h2>
|
|
|
|
|
2022-06-06 05:29:39 +00:00
|
|
|
<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-09 05:13:09 +00:00
|
|
|
<label for="title">Title</label><br/>
|
|
|
|
<input class="title-input" id="title" type="text" name="title" value="{{($page).Title}}" required/><br/>
|
|
|
|
{{ if $editableSlugs }}
|
2022-06-07 06:59:41 +00:00
|
|
|
<label for="slug">Slug</label><br/>
|
|
|
|
<input class="slug-input" id="slug" type="text" name="slug" value="{{$slug}}" required/><br/>
|
2022-06-05 04:34:20 +00:00
|
|
|
{{ end }}
|
2022-06-07 06:59:41 +00:00
|
|
|
<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/>
|
2022-06-15 07:33:56 +00:00
|
|
|
<a target="_blank" class="fmt-help" href="/fmt-help">Formatting help</a>
|
2022-06-05 04:34:20 +00:00
|
|
|
<input type="submit" value="Save"/>
|
2022-06-03 04:56:38 +00:00
|
|
|
</form>
|
|
|
|
|
2022-06-13 06:32:14 +00:00
|
|
|
<details class="danger-zone wide"><summary>Danger Zone</summary>
|
2022-06-07 06:59:41 +00:00
|
|
|
<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>
|
2022-06-09 05:13:09 +00:00
|
|
|
|
|
|
|
{{ end }}
|
|
|
|
|
2022-06-07 06:59:41 +00:00
|
|
|
{{ template "footer" . }}
|