summaryrefslogtreecommitdiff
path: root/srv/src/http/tpl
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-08-18 23:07:09 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-08-18 23:07:09 -0600
commitc3135306b32e3ee18c3c412fbb2ea81b455201d5 (patch)
treef7dd21fc9e0bab9b06a713a8218e52be777f1b15 /srv/src/http/tpl
parentdfa9bcb9e23b10bb28973d1d27f05e04e8638320 (diff)
drafts functionality added, needs a publish button still
Diffstat (limited to 'srv/src/http/tpl')
-rw-r--r--srv/src/http/tpl/admin.html1
-rw-r--r--srv/src/http/tpl/draft-posts.html48
-rw-r--r--srv/src/http/tpl/edit-post.html10
3 files changed, 59 insertions, 0 deletions
diff --git a/srv/src/http/tpl/admin.html b/srv/src/http/tpl/admin.html
index 24b2770..3b10675 100644
--- a/srv/src/http/tpl/admin.html
+++ b/srv/src/http/tpl/admin.html
@@ -9,6 +9,7 @@ anything without providing credentials.
<ul>
<li><a href="{{ BlogURL "posts" }}">Posts</a></li>
<li><a href="{{ BlogURL "assets" }}">Assets</a></li>
+ <li><a href="{{ BlogURL "drafts" }}">Drafts (private)</a></li>
</ul>
{{ end }}
diff --git a/srv/src/http/tpl/draft-posts.html b/srv/src/http/tpl/draft-posts.html
new file mode 100644
index 0000000..f89fac5
--- /dev/null
+++ b/srv/src/http/tpl/draft-posts.html
@@ -0,0 +1,48 @@
+{{ define "body" }}
+
+ <h1>Drafts</h1>
+
+ <p>
+ <a href="{{ BlogURL "drafts/" }}?edit">
+ New Draft
+ </a>
+ </p>
+
+ {{ if ge .Payload.PrevPage 0 }}
+ <p>
+ <a href="?p={{ .Payload.PrevPage}}">&lt; &lt; Previous Page</a>
+ </p>
+ {{ end }}
+
+ <table>
+
+ {{ range .Payload.Posts }}
+ <tr>
+ <td><a href="{{ DraftURL .ID }}">{{ .Title }}</a></td>
+ <td>
+ <a href="{{ DraftURL .ID }}?edit">
+ Edit
+ </a>
+ </td>
+ <td>
+ <form
+ action="{{ DraftURL .ID }}?method=delete"
+ method="POST"
+ >
+ <input type="submit" value="Delete" />
+ </form>
+ </td>
+ </tr>
+ {{ end }}
+
+ </table>
+
+ {{ if ge .Payload.NextPage 0 }}
+ <p>
+ <a href="?p={{ .Payload.NextPage}}">Next Page &gt; &gt;</a>
+ </p>
+ {{ end }}
+
+{{ end }}
+
+{{ template "base.html" . }}
diff --git a/srv/src/http/tpl/edit-post.html b/srv/src/http/tpl/edit-post.html
index a585b82..ea1f2c1 100644
--- a/srv/src/http/tpl/edit-post.html
+++ b/srv/src/http/tpl/edit-post.html
@@ -15,6 +15,9 @@
type="text"
placeholder="e.g. how-to-fly-a-kite"
value="{{ .Payload.Post.ID }}" />
+ {{ else if .Payload.IsDraft }}
+ {{ .Payload.Post.ID }}
+ <input name="id" type="hidden" value="{{ .Payload.Post.ID }}" />
{{ else }}
<a href="{{ PostURL .Payload.Post.ID }}">{{ .Payload.Post.ID }}</a>
<input name="id" type="hidden" value="{{ .Payload.Post.ID }}" />
@@ -107,10 +110,17 @@
</form>
<p>
+ {{ if .Payload.IsDraft }}
+ <a href="{{ BlogURL "drafts/" }}">
+ Back to Drafts
+ </a>
+ {{ else }}
<a href="{{ BlogURL "posts/" }}">
Back to Posts
</a>
+ {{ end }}
</p>
+
{{ end }}
{{ template "base.html" . }}