From 93a8843e2e3391459fd333aef9e5c7617608c2b3 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 18 May 2024 15:55:59 +0200 Subject: Remove most rendering related querying from go http handlers --- src/http/tpl/post-edit.html | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/http/tpl/post-edit.html') 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) }} +

{{ if .Payload.IsDraft }} @@ -21,19 +25,19 @@ Unique ID - {{ if eq .Payload.Post.ID "" }} + {{ if eq $post.ID "" }} + value="{{ $post.ID }}" /> {{ else if .Payload.IsDraft }} - {{ .Payload.Post.ID }} - + {{ $post.ID }} + {{ else }} - {{ .Payload.Post.ID }} - + {{ $post.ID }} + {{ end }} @@ -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 }} Existing tags: - {{ range $i, $tag := .Payload.Tags }} + {{ range $i, $tag := $tags }} {{ if ne $i 0 }} {{ end }}{{ $tag }} {{ end }} @@ -67,7 +71,7 @@ + value="{{ $post.Series }}" /> @@ -78,7 +82,7 @@ name="title" type="text" required - value="{{ .Payload.Post.Title }}" /> + value="{{ $post.Title }}" /> @@ -88,7 +92,7 @@ + value="{{ $post.Description }}" /> @@ -98,7 +102,7 @@ -- cgit v1.2.3