mediocre-blog/srv/src/http/tpl/edit-post.html

103 lines
2.6 KiB
HTML
Raw Normal View History

2022-05-20 16:13:46 +00:00
{{ define "body" }}
<form method="POST" action="{{ BlogURL "posts/" }}">
<div class="row">
<div class="columns six">
<label for="idInput">Unique ID</label>
2022-05-21 17:20:45 +00:00
{{ if eq .Payload.Post.ID "" }}
<input
id="idInput"
name="id"
class="u-full-width"
type="text"
placeholder="e.g. how-to-fly-a-kite"
2022-05-21 17:20:45 +00:00
value="{{ .Payload.Post.ID }}" />
{{ else }}
2022-05-21 17:20:45 +00:00
<a href="{{ PostURL .Payload.Post.ID }}" target="_blank">{{ .Payload.Post.ID }}</a>
<input name="id" type="hidden" value="{{ .Payload.Post.ID }}" />
{{ end }}
2022-05-20 16:13:46 +00:00
</div>
<div class="columns three">
<label for="tagsInput">Tags (space separated)</label>
<input
id="tagsInput"
name="tags"
class="u-full-width"
type="text"
2022-05-21 17:20:45 +00:00
value="{{ range $i, $tag := .Payload.Post.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }}" />
<p class="light">
Existing tags: {{ range $i, $tag := .Payload.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }}
</p>
2022-05-20 16:13:46 +00:00
</div>
<div class="columns three">
<label for="seriesInput">Series</label>
<input
id="seriesInput"
name="series"
class="u-full-width"
type="text"
2022-05-21 17:20:45 +00:00
value="{{ .Payload.Post.Series }}" />
2022-05-20 16:13:46 +00:00
</div>
</div>
<div class="row">
<div class="columns six">
<label for="titleInput">Title</label>
<input
id="titleInput"
name="title"
class="u-full-width"
type="text"
2022-05-21 17:20:45 +00:00
value="{{ .Payload.Post.Title }}" />
2022-05-20 16:13:46 +00:00
</div>
<div class="columns six">
<label for="descrInput">Description</label>
<input
id="descrInput"
name="description"
class="u-full-width"
type="text"
2022-05-21 17:20:45 +00:00
value="{{ .Payload.Post.Description }}" />
2022-05-20 16:13:46 +00:00
</div>
</div>
<div class="row">
<div class="columns twelve">
<textarea
name="body"
class="u-full-width"
placeholder="Blog body"
style="height: 50vh;"
>
2022-05-21 17:20:45 +00:00
{{- .Payload.Post.Body -}}
2022-05-20 16:13:46 +00:00
</textarea>
</div>
</div>
2022-05-20 17:06:21 +00:00
<input
type="submit"
value="Preview"
2022-05-21 17:20:45 +00:00
formaction="{{ BlogURL "posts/" }}{{ .Payload.Post.ID }}?method=preview"
2022-05-20 17:06:21 +00:00
formtarget="_blank"
/>
<input type="submit" value="Save" formaction="{{ BlogURL "posts/" }}" />
<a href="{{ BlogURL "posts/" }}">
<button type="button">Cancel</button>
</a>
2022-05-20 16:13:46 +00:00
</form>
{{ end }}
{{ template "base.html" . }}