A fast and simple blog backend.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
mediocre-blog/srv/src/http/tpl/edit-post.html

106 lines
2.7 KiB

{{ define "body" }}
<form method="POST" action="{{ BlogURL "posts/" }}">
{{ .CSRFFormInput }}
<div class="row">
<div class="columns six">
<label for="idInput">Unique ID</label>
{{ if eq .Payload.Post.ID "" }}
<input
id="idInput"
name="id"
class="u-full-width"
type="text"
placeholder="e.g. how-to-fly-a-kite"
value="{{ .Payload.Post.ID }}" />
{{ else }}
<a href="{{ PostURL .Payload.Post.ID }}" target="_blank">{{ .Payload.Post.ID }}</a>
<input name="id" type="hidden" value="{{ .Payload.Post.ID }}" />
{{ end }}
</div>
<div class="columns three">
<label for="tagsInput">Tags (space separated)</label>
<input
id="tagsInput"
name="tags"
class="u-full-width"
type="text"
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>
</div>
<div class="columns three">
<label for="seriesInput">Series</label>
<input
id="seriesInput"
name="series"
class="u-full-width"
type="text"
value="{{ .Payload.Post.Series }}" />
</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"
value="{{ .Payload.Post.Title }}" />
</div>
<div class="columns six">
<label for="descrInput">Description</label>
<input
id="descrInput"
name="description"
class="u-full-width"
type="text"
value="{{ .Payload.Post.Description }}" />
</div>
</div>
<div class="row">
<div class="columns twelve">
<textarea
name="body"
class="u-full-width"
placeholder="Blog body"
style="height: 50vh;"
>
{{- .Payload.Post.Body -}}
</textarea>
</div>
</div>
<input
type="submit"
value="Preview"
formaction="{{ BlogURL "posts/" }}{{ .Payload.Post.ID }}?method=preview"
formtarget="_blank"
/>
<input type="submit" value="Save" formaction="{{ BlogURL "posts/" }}" />
<a href="{{ BlogURL "posts/" }}">
<button type="button">Cancel</button>
</a>
</form>
{{ template "load-csrf.html" . }}
{{ end }}
{{ template "base.html" . }}