diff options
Diffstat (limited to 'src/http/tpl/post-edit.html')
-rw-r--r-- | src/http/tpl/post-edit.html | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/http/tpl/post-edit.html b/src/http/tpl/post-edit.html index c66b60a..28dcd0e 100644 --- a/src/http/tpl/post-edit.html +++ b/src/http/tpl/post-edit.html @@ -1,5 +1,9 @@ {{ define "body" }} +{{ $tags := .GetTags }} + +{{ $post := (or (and .Payload.IsDraft .GetThisDraftPost) .GetThisPost) }} + <p> {{ if .Payload.IsDraft }} <a href="{{ BlogURL "drafts?method=manage" }}"> @@ -21,19 +25,19 @@ Unique ID </td> <td> - {{ if eq .Payload.Post.ID "" }} + {{ if eq $post.ID "" }} <input name="id" type="text" required placeholder="e.g. how-to-fly-a-kite" - value="{{ .Payload.Post.ID }}" /> + value="{{ $post.ID }}" /> {{ else if .Payload.IsDraft }} - {{ .Payload.Post.ID }} - <input name="id" type="hidden" value="{{ .Payload.Post.ID }}" /> + {{ $post.ID }} + <input name="id" type="hidden" value="{{ $post.ID }}" /> {{ else }} - <a href="{{ PostURL .Payload.Post.ID }}">{{ .Payload.Post.ID }}</a> - <input name="id" type="hidden" value="{{ .Payload.Post.ID }}" /> + <a href="{{ PostURL $post.ID }}">{{ $post.ID }}</a> + <input name="id" type="hidden" value="{{ $post.ID }}" /> {{ end }} </td> </tr> @@ -45,15 +49,15 @@ name="tags" type="text" required - value="{{- range $i, $tag := .Payload.Post.Tags -}} + value="{{- range $i, $tag := $post.Tags -}} {{- if ne $i 0 }} {{ end }}{{ $tag -}} {{- end -}} "/> - {{ if gt (len .Payload.Tags) 0 }} + {{ if $tags }} <em> Existing tags: - {{ range $i, $tag := .Payload.Tags }} + {{ range $i, $tag := $tags }} {{ if ne $i 0 }} {{ end }}{{ $tag }} {{ end }} </em> @@ -67,7 +71,7 @@ <input name="series" type="text" - value="{{ .Payload.Post.Series }}" /> + value="{{ $post.Series }}" /> </td> </tr> @@ -78,7 +82,7 @@ name="title" type="text" required - value="{{ .Payload.Post.Title }}" /> + value="{{ $post.Title }}" /> </td> </tr> @@ -88,7 +92,7 @@ <input name="description" type="text" - value="{{ .Payload.Post.Description }}" /> + value="{{ $post.Description }}" /> </td> </tr> @@ -98,7 +102,7 @@ <select name="format" required> <option value=""></option> - {{ $format := .Payload.Post.Format }} + {{ $format := $post.Format }} {{ range .Payload.Formats -}} <option {{- if eq . $format }} @@ -122,7 +126,7 @@ placeholder="Post body" style="width:100%;height: 75vh;" > - {{- .Payload.Post.Body -}} + {{- $post.Body -}} </textarea> </p> @@ -131,7 +135,7 @@ <input type="submit" value="Preview" - formaction="{{ BlogURL "posts/" }}{{ .Payload.Post.ID }}?method=preview" + formaction="{{ BlogURL "posts/" }}{{ $post.ID }}?method=preview" formtarget="_blank" /> |