summaryrefslogtreecommitdiff
path: root/srv/src/api/tpl
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-20 10:13:46 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-20 10:13:46 -0600
commit75044eef0331bb9448da813288aafc6735ce7c22 (patch)
treea2fb34b0811cb524d87016e968255d2b6771d06d /srv/src/api/tpl
parent0bc0204f0b718464d7ea9d97d6d03ee81f1953c6 (diff)
Implement edit post page
Diffstat (limited to 'srv/src/api/tpl')
-rw-r--r--srv/src/api/tpl/edit-post.html82
-rw-r--r--srv/src/api/tpl/index.html4
-rw-r--r--srv/src/api/tpl/post.html4
-rw-r--r--srv/src/api/tpl/posts.html2
4 files changed, 87 insertions, 5 deletions
diff --git a/srv/src/api/tpl/edit-post.html b/srv/src/api/tpl/edit-post.html
new file mode 100644
index 0000000..9e30d4d
--- /dev/null
+++ b/srv/src/api/tpl/edit-post.html
@@ -0,0 +1,82 @@
+{{ define "body" }}
+
+ <form method="POST" action="{{ BlogURL "posts/" }}">
+
+ <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 }}" />
+ </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.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }}" />
+ </div>
+
+ <div class="columns three">
+ <label for="seriesInput">Series</label>
+ <input
+ id="seriesInput"
+ name="series"
+ class="u-full-width"
+ type="text"
+ value="{{ .Payload.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.Title }}" />
+ </div>
+
+ <div class="columns six">
+ <label for="descrInput">Description</label>
+ <input
+ id="descrInput"
+ name="description"
+ class="u-full-width"
+ type="text"
+ value="{{ .Payload.Description }}" />
+ </div>
+
+ </div>
+
+ <div class="row">
+ <div class="columns twelve">
+ <textarea
+ name="body"
+ class="u-full-width"
+ placeholder="Blog body"
+ style="height: 50vh;"
+ >
+ {{ .Payload.Body }}
+ </textarea>
+ </div>
+ </div>
+
+ <input type="submit" value="Save" />
+
+ </form>
+
+{{ end }}
+
+{{ template "base.html" . }}
diff --git a/srv/src/api/tpl/index.html b/srv/src/api/tpl/index.html
index 946a3e4..e27cbef 100644
--- a/srv/src/api/tpl/index.html
+++ b/srv/src/api/tpl/index.html
@@ -7,9 +7,9 @@
<h2>
<a href="{{ PostURL .ID }}">{{ .Title }}</a>
</h2>
- <span>{{ .PublishedAt.Format "2006-01-02" }}</span>
+ <span>{{ DateTimeFormat .PublishedAt }}</span>
{{ if not .LastUpdatedAt.IsZero }}
- <span>(Updated {{ .LastUpdatedAt.Format "2006-01-02" }})</span>
+ <span>(Updated {{ DateTimeFormat .LastUpdatedAt }})</span>
{{ end }}
<p>{{ .Description }}</p>
</li>
diff --git a/srv/src/api/tpl/post.html b/srv/src/api/tpl/post.html
index fadab3c..474d7c2 100644
--- a/srv/src/api/tpl/post.html
+++ b/srv/src/api/tpl/post.html
@@ -5,10 +5,10 @@
{{ .Payload.Title }}
</h1>
<div class="light">
- {{ .Payload.PublishedAt.Format "2006-01-02" }}
+ {{ DateTimeFormat .Payload.PublishedAt }}
&nbsp;•&nbsp;
{{ if not .Payload.LastUpdatedAt.IsZero }}
- (Updated {{ .Payload.LastUpdatedAt.Format "2006-01-02" }})
+ (Updated {{ DateTimeFormat .Payload.LastUpdatedAt }})
&nbsp;•&nbsp;
{{ end }}
<em>{{ .Payload.Description }}</em>
diff --git a/srv/src/api/tpl/posts.html b/srv/src/api/tpl/posts.html
index e701f59..714cf07 100644
--- a/srv/src/api/tpl/posts.html
+++ b/srv/src/api/tpl/posts.html
@@ -22,7 +22,7 @@
<p style="text-align: center;">
- <a href="{{ BlogURL "posts/" }}?method=new">
+ <a href="{{ BlogURL "posts/" }}?method=edit">
<button>New Post</button>
</a>
</p>