Changed visual layout for to-be-published articles
This commit is contained in:
parent
803c5bbdbd
commit
83a64a4cf3
@ -54,7 +54,9 @@ func main() {
|
|||||||
mux.HandleFunc("GET /edit-user/", view.EditUser(args, db, store))
|
mux.HandleFunc("GET /edit-user/", view.EditUser(args, db, store))
|
||||||
mux.HandleFunc("GET /hub/", view.ShowHub(args, db, store))
|
mux.HandleFunc("GET /hub/", view.ShowHub(args, db, store))
|
||||||
mux.HandleFunc("GET /logout/", view.Logout(args, store))
|
mux.HandleFunc("GET /logout/", view.Logout(args, store))
|
||||||
|
mux.HandleFunc("GET /publish-article/{id}/", view.PublishArticle(args, db, store))
|
||||||
mux.HandleFunc("GET /publish-issue/", view.PublishLatestIssue(args, db, store))
|
mux.HandleFunc("GET /publish-issue/", view.PublishLatestIssue(args, db, store))
|
||||||
|
mux.HandleFunc("GET /reject-article/{id}/", view.RejectArticle(args, db, store))
|
||||||
mux.HandleFunc("GET /rejected-articles/", view.ShowRejectedArticles(args, db, store))
|
mux.HandleFunc("GET /rejected-articles/", view.ShowRejectedArticles(args, db, store))
|
||||||
mux.HandleFunc("GET /review-rejected-article/{id}/", view.ReviewRejectedArticle(args, db, store))
|
mux.HandleFunc("GET /review-rejected-article/{id}/", view.ReviewRejectedArticle(args, db, store))
|
||||||
mux.HandleFunc("GET /review-unpublished-article/{id}/", view.ReviewUnpublishedArticle(args, db, store))
|
mux.HandleFunc("GET /review-unpublished-article/{id}/", view.ReviewUnpublishedArticle(args, db, store))
|
||||||
@ -73,8 +75,6 @@ func main() {
|
|||||||
mux.HandleFunc("POST /add-tag/", view.AddTag(args, db, store))
|
mux.HandleFunc("POST /add-tag/", view.AddTag(args, db, store))
|
||||||
mux.HandleFunc("POST /add-user/", view.AddUser(args, db, store))
|
mux.HandleFunc("POST /add-user/", view.AddUser(args, db, store))
|
||||||
mux.HandleFunc("POST /login/", view.Login(args, db, store))
|
mux.HandleFunc("POST /login/", view.Login(args, db, store))
|
||||||
mux.HandleFunc("POST /publish-article/{id}/", view.PublishArticle(args, db, store))
|
|
||||||
mux.HandleFunc("POST /reject-article/{id}/", view.RejectArticle(args, db, store))
|
|
||||||
mux.HandleFunc("POST /resubmit-article/{id}/", view.ResubmitArticle(args, db, store))
|
mux.HandleFunc("POST /resubmit-article/{id}/", view.ResubmitArticle(args, db, store))
|
||||||
mux.HandleFunc("POST /submit-article/", view.SubmitArticle(args, db, store))
|
mux.HandleFunc("POST /submit-article/", view.SubmitArticle(args, db, store))
|
||||||
mux.HandleFunc("POST /update-user/", view.UpdateUser(args, db, store))
|
mux.HandleFunc("POST /update-user/", view.UpdateUser(args, db, store))
|
||||||
|
@ -197,26 +197,53 @@ func ShowRejectedArticles(c *control.CliArgs, db *model.DB, s *control.CookieSto
|
|||||||
func ReviewUnpublishedArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) http.HandlerFunc {
|
func ReviewUnpublishedArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
type htmlData struct {
|
type htmlData struct {
|
||||||
Article *model.Article
|
Title string
|
||||||
|
Description string
|
||||||
|
Content template.HTML
|
||||||
Tags []*model.Tag
|
Tags []*model.Tag
|
||||||
|
ID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
data := new(htmlData)
|
data := new(htmlData)
|
||||||
|
|
||||||
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
|
data.ID, err = strconv.ParseInt(r.PathValue("id"), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Article, err = db.GetArticle(id)
|
article, err := db.GetArticle(data.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Tags, err = db.GetArticleTags(id)
|
data.Title, err = control.ConvertToPlain(article.Title)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Description, err = control.ConvertToPlain(article.Description)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
content, err := control.ConvertToHTML(article.Content)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data.Content = template.HTML(content)
|
||||||
|
|
||||||
|
data.Tags, err = db.GetArticleTags(data.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
@ -4,5 +4,7 @@ module.exports = {
|
|||||||
theme: {
|
theme: {
|
||||||
extend: {}
|
extend: {}
|
||||||
},
|
},
|
||||||
plugins: [],
|
plugins: [
|
||||||
|
require('@tailwindcss/typography')
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
<textarea name="article-content"></textarea>
|
<textarea name="article-content"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>Tags</span>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
{{range .}}
|
{{range .}}
|
||||||
<div>
|
<div>
|
||||||
@ -22,6 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="editor-images">
|
<div id="editor-images">
|
||||||
<input class="mb-2" name="article-image" type="file" hx-encoding="multipart/form-data" hx-post="/upload-image/"
|
<input class="mb-2" name="article-image" type="file" hx-encoding="multipart/form-data" hx-post="/upload-image/"
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
<textarea name="article-content" placeholder="Artikel">{{.Article.Content}}</textarea>
|
<textarea name="article-content" placeholder="Artikel">{{.Article.Content}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>Tags</span>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
{{range .Tags}}
|
{{range .Tags}}
|
||||||
<div>
|
<div>
|
||||||
@ -23,6 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="editor-images">
|
<div id="editor-images">
|
||||||
<input class="mb-2" name="article-image" type="file" hx-encoding="multipart/form-data" hx-post="/upload-image/"
|
<input class="mb-2" name="article-image" type="file" hx-encoding="multipart/form-data" hx-post="/upload-image/"
|
||||||
|
@ -1,21 +1,35 @@
|
|||||||
{{define "page-content"}}
|
{{define "page-content"}}
|
||||||
<form>
|
<div>
|
||||||
<h2>{{.Article.Title}}</h2>
|
<span>Titel</span>
|
||||||
<p>{{.Article.Description}}</p>
|
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||||
{{.Article.Content}}
|
{{.Title}}
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<span>Beschreibung</span>
|
||||||
|
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||||
|
{{.Description}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span>Artikel</span>
|
||||||
|
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||||
|
<div class="prose">
|
||||||
|
{{.Content}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span>Tags</span>
|
||||||
|
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||||
{{range .Tags}}
|
{{range .Tags}}
|
||||||
{{.Name}}
|
{{.Name}}
|
||||||
|
<br>
|
||||||
{{end}}
|
{{end}}
|
||||||
</p>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Veröffentlichen" hx-post="/publish-article/{{.Article.ID}}/"
|
<input class="action-btn" type="submit" value="Veröffentlichen" hx-get="/publish-article/{{.ID}}/"
|
||||||
hx-target="#page-content" />
|
|
||||||
<input class="btn" type="submit" value="Ablehnen" hx-post="/reject-article/{{.Article.ID}}/"
|
|
||||||
hx-target="#page-content" />
|
hx-target="#page-content" />
|
||||||
|
<input class="btn" type="submit" value="Ablehnen" hx-get="/reject-article/{{.ID}}/" hx-target="#page-content" />
|
||||||
<button class="btn" hx-get="/hub/" hx-target="#page-content">Zurück</button>
|
<button class="btn" hx-get="/hub/" hx-target="#page-content">Zurück</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user