Compare commits
No commits in common. "d62c5a4078a76e21d4766cd3043031e72e361678" and "c74bdeba72450cd0e3dca79e946aa61f091fddba" have entirely different histories.
d62c5a4078
...
c74bdeba72
@ -54,9 +54,7 @@ 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))
|
||||||
@ -75,6 +73,8 @@ 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,53 +197,26 @@ 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 {
|
||||||
Title string
|
Article *model.Article
|
||||||
Description string
|
|
||||||
Content template.HTML
|
|
||||||
Tags []*model.Tag
|
Tags []*model.Tag
|
||||||
ID int64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
|
||||||
data := new(htmlData)
|
data := new(htmlData)
|
||||||
|
|
||||||
data.ID, err = strconv.ParseInt(r.PathValue("id"), 10, 64)
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
article, err := db.GetArticle(data.ID)
|
data.Article, err = db.GetArticle(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.Title, err = control.ConvertToPlain(article.Title)
|
data.Tags, err = db.GetArticleTags(id)
|
||||||
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,7 +4,5 @@ module.exports = {
|
|||||||
theme: {
|
theme: {
|
||||||
extend: {}
|
extend: {}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [],
|
||||||
require('@tailwindcss/typography')
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
@apply bg-slate-200 border my-2 px-3 py-2 rounded-md w-full hover:bg-slate-100;
|
@apply bg-slate-50 border my-2 px-3 py-2 rounded-md w-full hover:bg-slate-100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn {
|
.action-btn {
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
<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>
|
||||||
@ -24,7 +22,6 @@
|
|||||||
</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/"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<link href="/web/static/css/style.css" rel="stylesheet">
|
<link href="/web/static/css/style.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="flex flex-col justify-between min-h-screen bg-slate-50">
|
<body class="flex flex-col justify-between min-h-[100dvh] bg-slate-50">
|
||||||
<header class="my-8">
|
<header class="my-8">
|
||||||
<h1 class="font-bold text-4xl text-center">Orient Editor</h1>
|
<h1 class="font-bold text-4xl text-center">Orient Editor</h1>
|
||||||
</header>
|
</header>
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
<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>
|
||||||
@ -25,7 +23,6 @@
|
|||||||
</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,35 +1,21 @@
|
|||||||
{{define "page-content"}}
|
{{define "page-content"}}
|
||||||
<div>
|
<form>
|
||||||
<span>Titel</span>
|
<h2>{{.Article.Title}}</h2>
|
||||||
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
<p>{{.Article.Description}}</p>
|
||||||
{{.Title}}
|
{{.Article.Content}}
|
||||||
</div>
|
|
||||||
|
|
||||||
<span>Beschreibung</span>
|
<p>
|
||||||
<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}}
|
||||||
</div>
|
</p>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Veröffentlichen" hx-get="/publish-article/{{.ID}}/"
|
<input class="action-btn" type="submit" value="Veröffentlichen" hx-post="/publish-article/{{.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>
|
||||||
</div>
|
</form>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user