From d239a86444d5e4c2cbf5bdd9df23cc81fde9862c Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Sun, 12 Jan 2025 14:22:11 +0100 Subject: [PATCH] Make creator's author checkbox work sensibly --- cmd/frontend/articles.go | 13 +++++++------ web/templates/editor.html | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/frontend/articles.go b/cmd/frontend/articles.go index 7610777..8bf5088 100644 --- a/cmd/frontend/articles.go +++ b/cmd/frontend/articles.go @@ -78,6 +78,7 @@ func WriteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc { return } data.Creator = data.ArticleUsers[fmt.Sprint(creator.LastName, creator.FirstName, creator.ID)] + data.Creator.ArticleRole = Author delete(data.ArticleUsers, fmt.Sprint(creator.LastName, creator.FirstName, creator.ID)) data.Tags, err = db.GetTagList() @@ -155,10 +156,10 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc { } } - if r.PostFormValue("creator") == "contributor" { - contributors = append(contributors, article.CreatorID) - } else { + if r.PostFormValue("creator") == "author" { authors = append(authors, article.CreatorID) + } else { + contributors = append(contributors, article.CreatorID) } if len(authors) == 0 { http.Error(w, "Es muss mindestens einen Autor geben.", http.StatusBadRequest) @@ -274,10 +275,10 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc { } } - if r.PostFormValue("creator") == "contributor" { - contributors = append(contributors, article.CreatorID) - } else { + if r.PostFormValue("creator") == "author" { authors = append(authors, article.CreatorID) + } else { + contributors = append(contributors, article.CreatorID) } if len(authors) == 0 { http.Error(w, "Es muss mindestens einen Autor geben.", http.StatusBadRequest) diff --git a/web/templates/editor.html b/web/templates/editor.html index 81cd163..91944bb 100644 --- a/web/templates/editor.html +++ b/web/templates/editor.html @@ -75,9 +75,9 @@
- - + +