summaryrefslogtreecommitdiff
path: root/srv/src/api/tpl
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-20 10:47:22 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-20 10:47:22 -0600
commit2c4b617ddeb71a5856075c94dcc7dfff3cfcbcaa (patch)
tree66ea2c37d91e51c7b426d13db0203e5851c66bfc /srv/src/api/tpl
parent75044eef0331bb9448da813288aafc6735ce7c22 (diff)
Implement saving of new and edited posts
Diffstat (limited to 'srv/src/api/tpl')
-rw-r--r--srv/src/api/tpl/edit-post.html30
1 files changed, 22 insertions, 8 deletions
diff --git a/srv/src/api/tpl/edit-post.html b/srv/src/api/tpl/edit-post.html
index 9e30d4d..708858d 100644
--- a/srv/src/api/tpl/edit-post.html
+++ b/srv/src/api/tpl/edit-post.html
@@ -1,17 +1,31 @@
{{ define "body" }}
+ <p>
+ <a href="{{ BlogURL "posts/" }}">
+ <button>Back to Posts</button>
+ </a>
+ </p>
+
<form method="POST" action="{{ BlogURL "posts/" }}">
+ {{ .CSRFFormInput }}
+
<div class="row">
<div class="columns six">
- <label for="idInput">Unique ID (e.g. "how-to-fly-a-kite")</label>
- <input
- id="idInput"
- name="id"
- class="u-full-width"
- type="text"
- value="{{ .Payload.ID }}" />
+ <label for="idInput">Unique ID</label>
+ {{ if eq .Payload.ID "" }}
+ <input
+ id="idInput"
+ name="id"
+ class="u-full-width"
+ type="text"
+ placeholder="e.g. how-to-fly-a-kite"
+ value="{{ .Payload.ID }}" />
+ {{ else }}
+ <a href="{{ PostURL .Payload.ID }}" target="_blank">{{ .Payload.ID }}</a>
+ <input name="id" type="hidden" value="{{ .Payload.ID }}" />
+ {{ end }}
</div>
<div class="columns three">
@@ -68,7 +82,7 @@
placeholder="Blog body"
style="height: 50vh;"
>
- {{ .Payload.Body }}
+ {{- .Payload.Body -}}
</textarea>
</div>
</div>