diff --git a/srv/src/http/posts.go b/srv/src/http/posts.go index daa756c..c05f3de 100644 --- a/srv/src/http/posts.go +++ b/srv/src/http/posts.go @@ -205,7 +205,21 @@ func (a *api) renderEditPostHandler() http.Handler { } } - executeTemplate(rw, r, tpl, storedPost) + tags, err := a.params.PostStore.GetTags() + if err != nil { + apiutil.InternalServerError(rw, r, fmt.Errorf("fetching tags: %w", err)) + return + } + + tplPayload := struct { + Post post.StoredPost + Tags []string + }{ + Post: storedPost, + Tags: tags, + } + + executeTemplate(rw, r, tpl, tplPayload) }) } diff --git a/srv/src/http/tpl/edit-post.html b/srv/src/http/tpl/edit-post.html index 9ccfa2a..114369a 100644 --- a/srv/src/http/tpl/edit-post.html +++ b/srv/src/http/tpl/edit-post.html @@ -8,17 +8,17 @@
+ Existing tags: {{ range $i, $tag := .Payload.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }} +