summaryrefslogtreecommitdiff
path: root/srv/src/http/tpl/edit-post.html
diff options
context:
space:
mode:
Diffstat (limited to 'srv/src/http/tpl/edit-post.html')
-rw-r--r--srv/src/http/tpl/edit-post.html141
1 files changed, 77 insertions, 64 deletions
diff --git a/srv/src/http/tpl/edit-post.html b/srv/src/http/tpl/edit-post.html
index 1a81df4..9a2f085 100644
--- a/srv/src/http/tpl/edit-post.html
+++ b/srv/src/http/tpl/edit-post.html
@@ -1,87 +1,96 @@
{{ define "body" }}
- <form method="POST" action="{{ BlogURL "posts/" }}">
+{{ if gt (len .Payload.Tags) 0 }}
+<p>
+ Existing tags:
+ <em>
+ {{ range $i, $tag := .Payload.Tags }}
+ {{ if ne $i 0 }} {{ end }}{{ $tag }}
+ {{ end }}
+ </em>
+</p>
+{{ end }}
+
+<form method="POST" action="{{ BlogURL "posts/" }}">
- <div class="row">
+ <table>
- <div class="columns six">
- <label for="idInput">Unique ID</label>
+ <tr>
+ <td>
+ Unique ID
+ </td>
+ <td>
{{ 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 }}" />
+ <input
+ name="id"
+ 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 }}" />
+ <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>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <p>Tags (space separated)</p>
+ </td>
+ <td>
<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>
+ value="{{- range $i, $tag := .Payload.Post.Tags -}}
+ {{- if ne $i 0 }} {{ end }}{{ $tag -}}
+ {{- end -}}
+ "/>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Series</td>
+ <td>
<input
- id="seriesInput"
name="series"
- class="u-full-width"
type="text"
value="{{ .Payload.Post.Series }}" />
- </div>
+ </td>
+ </tr>
- </div>
-
- <div class="row">
-
- <div class="columns six">
- <label for="titleInput">Title</label>
+ <tr>
+ <td>Title</td>
+ <td>
<input
- id="titleInput"
name="title"
- class="u-full-width"
type="text"
value="{{ .Payload.Post.Title }}" />
- </div>
+ </td>
+ </tr>
- <div class="columns six">
- <label for="descrInput">Description</label>
+ <tr>
+ <td>Description</td>
+ <td>
<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>
-
+ </td>
+ </tr>
+
+ </table>
+
+ <p>
+ <textarea
+ name="body"
+ placeholder="Blog body"
+ style="width:100%;height: 75vh;"
+ >
+ {{- .Payload.Post.Body -}}
+ </textarea>
+ </p>
+
+ <p>
<input
type="submit"
value="Preview"
@@ -89,14 +98,18 @@
formtarget="_blank"
/>
- <input type="submit" value="Save" formaction="{{ BlogURL "posts/" }}" />
+ {{ if eq .Payload.Post.ID "" }}
+ <input type="submit" value="Publish" formaction="{{ BlogURL "posts/" }}" />
+ {{ else }}
+ <input type="submit" value="Update" formaction="{{ BlogURL "posts/" }}" />
+ {{ end }}
<a href="{{ BlogURL "posts/" }}">
- <button type="button">Cancel</button>
+ <button type="button">Back</button>
</a>
+ </p>
- </form>
-
+</form>
{{ end }}
{{ template "base.html" . }}