diff options
Diffstat (limited to 'internal/web/handlers_posts.go')
| -rw-r--r-- | internal/web/handlers_posts.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/web/handlers_posts.go b/internal/web/handlers_posts.go index 16d9cf2..ad0a241 100644 --- a/internal/web/handlers_posts.go +++ b/internal/web/handlers_posts.go @@ -69,7 +69,7 @@ func (s *Server) handlePostForm(w http.ResponseWriter, r *http.Request) { } else if hp, err := blogStore(r).HomePage(r.Context()); err == nil { p.PageID = hp.ID } - s.render(w, r, "dashboard/post_form.html", map[string]any{"post": p, "pages": pages, "allTags": allTags, "tagged": tagSet(p.Tags), "newTags": ""}) + s.render(w, r, "dashboard/post_form.html", map[string]any{"post": p, "pages": pages, "allTags": allTags, "tagsText": tagsText(p.Tags)}) } func (s *Server) handlePostSave(w http.ResponseWriter, r *http.Request) { @@ -95,8 +95,7 @@ func (s *Server) handlePostSave(w http.ResponseWriter, r *http.Request) { p.BodyMD = strings.ReplaceAll(r.FormValue("body"), "\r\n", "\n") p.Published = r.FormValue("published") == "on" p.PageID, _ = strconv.ParseInt(r.FormValue("page_id"), 10, 64) - // The ticked existing tags and the comma-separated new ones are one list. - tags, tagsOK := parseTags(append(r.Form["tag"], strings.Split(r.FormValue("new_tags"), ",")...)) + tags, tagsOK := parseTags(strings.Split(r.FormValue("tags"), ",")) p.Tags = tags autoSlug := p.Slug == "" if autoSlug { @@ -104,7 +103,7 @@ func (s *Server) handlePostSave(w http.ResponseWriter, r *http.Request) { } fail := func(status int, msg string) { s.renderStatus(w, r, status, "dashboard/post_form.html", map[string]any{"post": p, "pages": pages, "error": msg, - "allTags": allTags, "tagged": tagSet(p.Tags), "newTags": r.FormValue("new_tags")}) + "allTags": allTags, "tagsText": r.FormValue("tags")}) } if at := strings.TrimSpace(r.FormValue("posted_at")); at != "" { // blank keeps the current date var ok bool |
