Compare commits
13 Commits
a33e7f9896
...
v0.6.1
Author | SHA1 | Date | |
---|---|---|---|
46aef4f12f | |||
1b29e328cf | |||
e50cb819f3 | |||
c32e38ca10 | |||
d7c8c7a43a | |||
1cd3edc90c | |||
0e768c9f61 | |||
1fcd775cc5 | |||
203a1ed147 | |||
ef1914ee5c | |||
084b101e31 | |||
b2db128aa9 | |||
081e880fb6 |
@ -50,11 +50,11 @@ func GetChannel(db *DB, title, link, description string) (*rss.Channel, error) {
|
|||||||
return channel, nil
|
return channel, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateRSS(c *Config, db *DB) (*string, error) {
|
func GenerateRSS(db *DB, title, link, desc string) (*string, error) {
|
||||||
channel := &rss.Channel{
|
channel := &rss.Channel{
|
||||||
Title: c.Title,
|
Title: title,
|
||||||
Link: c.Link,
|
Link: link,
|
||||||
Description: c.Description,
|
Description: desc,
|
||||||
Items: make([]*rss.Item, 0),
|
Items: make([]*rss.Item, 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,13 +89,18 @@ func GenerateRSS(c *Config, db *DB) (*string, error) {
|
|||||||
return nil, fmt.Errorf("error converting description to plain text for RSS feed: %v", err)
|
return nil, fmt.Errorf("error converting description to plain text for RSS feed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
articleContent, err := ConvertToHTML(article.Content)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error converting content to HTML for RSS feed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
channel.Items = append(channel.Items, &rss.Item{
|
channel.Items = append(channel.Items, &rss.Item{
|
||||||
Author: fmt.Sprint(user.FirstName, user.LastName),
|
|
||||||
Categories: tagNames,
|
|
||||||
Description: articleDescription,
|
|
||||||
Link: fmt.Sprintf("http://%s/article/serve/%d", c.Domain, article.ID),
|
|
||||||
PubDate: article.Created.Format(time.RFC1123Z),
|
|
||||||
Title: articleTitle,
|
Title: articleTitle,
|
||||||
|
Author: user.FirstName + " " + user.LastName,
|
||||||
|
PubDate: article.Created.Format(time.RFC1123Z),
|
||||||
|
Description: articleDescription,
|
||||||
|
Content: &rss.Content{Value: articleContent},
|
||||||
|
Categories: tagNames,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package calls
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
|
||||||
)
|
|
||||||
|
|
||||||
func ServeArticle(c *b.Config, db *b.DB) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if tokenIsVerified(w, r, c) {
|
|
||||||
idString := r.PathValue("id")
|
|
||||||
id, err := strconv.ParseInt(idString, 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
article, err := db.GetArticle(id)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprint(w, article.Content)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package calls
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
|
||||||
)
|
|
||||||
|
|
||||||
func ServeImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if tokenIsVerified(w, r, c) {
|
|
||||||
absFilepath, err := filepath.Abs(c.PicsDir)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
http.ServeFile(w, r, absFilepath+"/"+r.PathValue("pic"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -363,7 +363,7 @@ func PublishArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
feed, err := b.GenerateRSS(c, db)
|
feed, err := b.GenerateRSS(db, c.Title, c.Link, c.Description)
|
||||||
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)
|
||||||
@ -582,7 +582,7 @@ func DeleteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
feed, err := b.GenerateRSS(c, db)
|
feed, err := b.GenerateRSS(db, c.Title, c.Link, c.Description)
|
||||||
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)
|
||||||
|
26
cmd/frontend/images.go
Normal file
26
cmd/frontend/images.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package frontend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ServeImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if _, err := getSession(w, r, c, s); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
absFilepath, err := filepath.Abs(c.PicsDir)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
http.ServeFile(w, r, absFilepath+"/"+r.PathValue("pic"))
|
||||||
|
}
|
||||||
|
}
|
61
cmd/main.go
61
cmd/main.go
@ -49,42 +49,41 @@ func main() {
|
|||||||
http.FileServer(http.Dir(config.WebDir+"/static/"))))
|
http.FileServer(http.Dir(config.WebDir+"/static/"))))
|
||||||
mux.HandleFunc("/", f.HomePage(config, db, store))
|
mux.HandleFunc("/", f.HomePage(config, db, store))
|
||||||
|
|
||||||
mux.HandleFunc("GET /article/all-published", f.ShowPublishedArticles(config, db, store))
|
mux.HandleFunc("GET /create-tag", f.CreateTag(config, store))
|
||||||
mux.HandleFunc("GET /article/all-rejected", f.ShowRejectedArticles(config, db, store))
|
mux.HandleFunc("GET /create-user", f.CreateUser(config, store))
|
||||||
mux.HandleFunc("GET /article/all-unpublished", f.ShowUnpublishedArticles(config, db, store))
|
mux.HandleFunc("GET /delete-article/{id}", f.DeleteArticle(config, db, store))
|
||||||
mux.HandleFunc("GET /article/delete/{id}", f.DeleteArticle(config, db, store))
|
mux.HandleFunc("GET /delete-user/{id}", f.DeleteUser(config, db, store))
|
||||||
mux.HandleFunc("GET /article/publish/{id}", f.PublishArticle(config, db, store))
|
mux.HandleFunc("GET /edit-self", f.EditSelf(config, db, store))
|
||||||
mux.HandleFunc("GET /article/reject/{id}", f.RejectArticle(config, db, store))
|
mux.HandleFunc("GET /edit-user/{id}", f.EditUser(config, db, store))
|
||||||
mux.HandleFunc("GET /article/review-deletion/{id}", f.ReviewArticleForDeletion(config, db, store))
|
|
||||||
mux.HandleFunc("GET /article/review-rejected/{id}", f.ReviewRejectedArticle(config, db, store))
|
|
||||||
mux.HandleFunc("GET /article/review-unpublished/{id}", f.ReviewUnpublishedArticle(config, db, store))
|
|
||||||
mux.HandleFunc("GET /article/serve/{id}", c.ServeArticle(config, db))
|
|
||||||
mux.HandleFunc("GET /article/write", f.WriteArticle(config, db, store))
|
|
||||||
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
||||||
mux.HandleFunc("GET /image/serve/{pic}", c.ServeImage(config, store))
|
|
||||||
mux.HandleFunc("GET /issue/publish", f.PublishLatestIssue(config, db, store))
|
|
||||||
mux.HandleFunc("GET /issue/this", f.ShowCurrentArticles(config, db, store))
|
|
||||||
mux.HandleFunc("GET /logout", f.Logout(config, store))
|
mux.HandleFunc("GET /logout", f.Logout(config, store))
|
||||||
mux.HandleFunc("GET /pdf/get-list", c.ServePDFList(config))
|
mux.HandleFunc("GET /pdf/get-list", c.ServePDFList(config))
|
||||||
mux.HandleFunc("GET /pdf/serve/{id}", c.ServePDF(config))
|
mux.HandleFunc("GET /pdf/{id}", c.ServePDF(config))
|
||||||
mux.HandleFunc("GET /rss/serve", c.ServeRSS(config))
|
mux.HandleFunc("GET /pics/{pic}", f.ServeImage(config, store))
|
||||||
mux.HandleFunc("GET /tag/create", f.CreateTag(config, store))
|
mux.HandleFunc("GET /publish-article/{id}", f.PublishArticle(config, db, store))
|
||||||
mux.HandleFunc("GET /user/create", f.CreateUser(config, store))
|
mux.HandleFunc("GET /publish-issue", f.PublishLatestIssue(config, db, store))
|
||||||
mux.HandleFunc("GET /user/delete/{id}", f.DeleteUser(config, db, store))
|
mux.HandleFunc("GET /published-articles", f.ShowPublishedArticles(config, db, store))
|
||||||
mux.HandleFunc("GET /user/edit/{id}", f.EditUser(config, db, store))
|
mux.HandleFunc("GET /reject-article/{id}", f.RejectArticle(config, db, store))
|
||||||
mux.HandleFunc("GET /user/edit/self", f.EditSelf(config, db, store))
|
mux.HandleFunc("GET /rejected-articles", f.ShowRejectedArticles(config, db, store))
|
||||||
mux.HandleFunc("GET /user/show-all/delete", f.ShowAllUsers(config, db, store, "delete"))
|
mux.HandleFunc("GET /review-article-for-deletion/{id}", f.ReviewArticleForDeletion(config, db, store))
|
||||||
mux.HandleFunc("GET /user/show-all/edit", f.ShowAllUsers(config, db, store, "edit"))
|
mux.HandleFunc("GET /review-rejected-article/{id}", f.ReviewRejectedArticle(config, db, store))
|
||||||
|
mux.HandleFunc("GET /review-unpublished-article/{id}", f.ReviewUnpublishedArticle(config, db, store))
|
||||||
|
mux.HandleFunc("GET /rss", c.ServeRSS(config))
|
||||||
|
mux.HandleFunc("GET /show-all-users-edit", f.ShowAllUsers(config, db, store, "edit-user"))
|
||||||
|
mux.HandleFunc("GET /show-all-users-delete", f.ShowAllUsers(config, db, store, "delete-user"))
|
||||||
|
mux.HandleFunc("GET /this-issue", f.ShowCurrentArticles(config, db, store))
|
||||||
|
mux.HandleFunc("GET /unpublished-articles", f.ShowUnpublishedArticles(config, db, store))
|
||||||
|
mux.HandleFunc("GET /write-article", f.WriteArticle(config, db, store))
|
||||||
|
|
||||||
mux.HandleFunc("POST /article/resubmit/{id}", f.ResubmitArticle(config, db, store))
|
mux.HandleFunc("POST /add-first-user", f.AddFirstUser(config, db, store))
|
||||||
mux.HandleFunc("POST /article/submit", f.SubmitArticle(config, db, store))
|
mux.HandleFunc("POST /add-tag", f.AddTag(config, db, store))
|
||||||
mux.HandleFunc("POST /image/upload", f.UploadImage(config, store))
|
mux.HandleFunc("POST /add-user", f.AddUser(config, db, store))
|
||||||
mux.HandleFunc("POST /login", f.Login(config, db, store))
|
mux.HandleFunc("POST /login", f.Login(config, db, store))
|
||||||
mux.HandleFunc("POST /tag/add", f.AddTag(config, db, store))
|
mux.HandleFunc("POST /resubmit-article/{id}", f.ResubmitArticle(config, db, store))
|
||||||
mux.HandleFunc("POST /user/add", f.AddUser(config, db, store))
|
mux.HandleFunc("POST /submit-article", f.SubmitArticle(config, db, store))
|
||||||
mux.HandleFunc("POST /user/add-first", f.AddFirstUser(config, db, store))
|
mux.HandleFunc("POST /update-self", f.UpdateSelf(config, db, store))
|
||||||
mux.HandleFunc("POST /user/update/{id}", f.UpdateUser(config, db, store))
|
mux.HandleFunc("POST /update-user/{id}", f.UpdateUser(config, db, store))
|
||||||
mux.HandleFunc("POST /user/update/self", f.UpdateSelf(config, db, store))
|
mux.HandleFunc("POST /upload-image", f.UploadImage(config, store))
|
||||||
|
|
||||||
log.Fatalln(http.ListenAndServe(config.Port, mux))
|
log.Fatalln(http.ListenAndServe(config.Port, mux))
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ CREATE TABLE users (
|
|||||||
first_name VARCHAR(50) NOT NULL,
|
first_name VARCHAR(50) NOT NULL,
|
||||||
last_name VARCHAR(50) NOT NULL,
|
last_name VARCHAR(50) NOT NULL,
|
||||||
role INT NOT NULL,
|
role INT NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE issues (
|
CREATE TABLE issues (
|
||||||
id INT AUTO_INCREMENT,
|
id INT AUTO_INCREMENT,
|
||||||
published BOOL NOT NULL,
|
published BOOL NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE articles (
|
CREATE TABLE articles (
|
||||||
@ -30,21 +30,21 @@ CREATE TABLE articles (
|
|||||||
rejected BOOL NOT NULL,
|
rejected BOOL NOT NULL,
|
||||||
author_id INT NOT NULL,
|
author_id INT NOT NULL,
|
||||||
issue_id INT NOT NULL,
|
issue_id INT NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY(id),
|
||||||
FOREIGN KEY (author_id) REFERENCES users (id),
|
FOREIGN KEY(author_id) REFERENCES users(id),
|
||||||
FOREIGN KEY (issue_id) REFERENCES issues (id)
|
FOREIGN KEY(issue_id) REFERENCES issues(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE tags (
|
CREATE TABLE tags (
|
||||||
id INT AUTO_INCREMENT,
|
id INT AUTO_INCREMENT,
|
||||||
name VARCHAR(50) NOT NULL UNIQUE,
|
name VARCHAR(50) NOT NULL UNIQUE,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE articles_tags (
|
CREATE TABLE articles_tags (
|
||||||
article_id INT,
|
article_id INT,
|
||||||
tag_id INT,
|
tag_id INT,
|
||||||
PRIMARY KEY (article_id, tag_id),
|
PRIMARY KEY(article_id, tag_id),
|
||||||
FOREIGN KEY (article_id) REFERENCES articles (id),
|
FOREIGN KEY(article_id) REFERENCES articles(id),
|
||||||
FOREIGN KEY (tag_id) REFERENCES tags (id)
|
FOREIGN KEY(tag_id) REFERENCES tags(id)
|
||||||
);
|
);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<form>
|
<form>
|
||||||
<input required name="tag" placeholder="Tag eingeben" type="text" />
|
<input required name="tag" placeholder="Tag eingeben" type="text" />
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Anlegen" hx-post="/tag/add" hx-target="#page-content" />
|
<input class="action-btn" type="submit" value="Anlegen" hx-post="/add-tag" hx-target="#page-content" />
|
||||||
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Anlegen" hx-post="/user/add" hx-target="#page-content" />
|
<input class="action-btn" type="submit" value="Anlegen" hx-post="/add-user" hx-target="#page-content" />
|
||||||
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<button class="action-btn" hx-get="/issue/publish" hx-target="#page-content">Ausgabe publizieren</button>
|
<button class="action-btn" hx-get="/publish-issue" hx-target="#page-content">Ausgabe publizieren</button>
|
||||||
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/user/update/self"
|
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/update-self"
|
||||||
hx-target="#page-content" />
|
hx-target="#page-content" />
|
||||||
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/user/update/{{.ID}}"
|
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/update-user/{{.ID}}"
|
||||||
hx-target="#page-content" />
|
hx-target="#page-content" />
|
||||||
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Senden" hx-post="/article/submit" hx-target="#page-content" />
|
<input class="action-btn" type="submit" value="Senden" hx-post="/submit-article" hx-target="#page-content" />
|
||||||
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append('article-image', file);
|
formData.append('article-image', file);
|
||||||
|
|
||||||
fetch('/image/upload', {
|
fetch('/upload-image', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Anlegen" hx-post="/user/add-first" hx-target="#page-content" />
|
<input class="action-btn" type="submit" value="Anlegen" hx-post="/add-first-user" hx-target="#page-content" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<h2>Autor</h2>
|
<h2>Autor</h2>
|
||||||
<div class="grid grid-cols-2 gap-x-4 gap-y-2">
|
<div class="grid grid-cols-2 gap-x-4 gap-y-2">
|
||||||
<button class="btn" hx-get="/article/write" hx-target="#page-content">Artikel schreiben</button>
|
<button class="btn" hx-get="/write-article" hx-target="#page-content">Artikel schreiben</button>
|
||||||
<button class="btn" hx-get="/article/all-rejected" hx-target="#page-content">Abgelehnte Artikel</button>
|
<button class="btn" hx-get="/rejected-articles" hx-target="#page-content">Abgelehnte Artikel</button>
|
||||||
<button class="btn" hx-get="/user/edit/self" hx-target="#page-content">Profil bearbeiten</button>
|
<a class="btn text-center" href="/rss">RSS Feed</a>
|
||||||
|
<button class="btn" hx-get="/edit-self" hx-target="#page-content">Profil bearbeiten</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -17,10 +18,10 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<h2>Redakteur</h2>
|
<h2>Redakteur</h2>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<button class="btn" hx-get="/article/all-unpublished" hx-target="#page-content">
|
<button class="btn" hx-get="/unpublished-articles" hx-target="#page-content">
|
||||||
Unveröffentlichte Artikel
|
Unveröffentlichte Artikel
|
||||||
</button>
|
</button>
|
||||||
<button class="btn" hx-get="/tag/create" hx-target="#page-content">Neuer Tag</button>
|
<button class="btn" hx-get="/create-tag" hx-target="#page-content">Neuer Tag</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -29,8 +30,8 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<h2>Herausgeber</h2>
|
<h2>Herausgeber</h2>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<button class="btn" hx-get="/issue/this" hx-target="#page-content">Diese Ausgabe</button>
|
<button class="btn" hx-get="/this-issue" hx-target="#page-content">Diese Ausgabe</button>
|
||||||
<button class="btn" hx-get="/article/all-published" hx-target="#page-content">Artikel löschen</button>
|
<button class="btn" hx-get="/published-articles" hx-target="#page-content">Artikel löschen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -38,10 +39,10 @@
|
|||||||
{{if eq . 0}}
|
{{if eq . 0}}
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<h2>Administrator</h2>
|
<h2>Administrator</h2>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-3 gap-4">
|
||||||
<button class="btn" hx-get="/user/create" hx-target="#page-content">Benutzer hinzufügen</button>
|
<button class="btn" hx-get="/create-user" hx-target="#page-content">Benutzer hinzufügen</button>
|
||||||
<button class="btn" hx-get="/user/show-all/edit" hx-target="#page-content">Benutzer bearbeiten</button>
|
<button class="btn" hx-get="/show-all-users-edit" hx-target="#page-content">Benutzer bearbeiten</button>
|
||||||
<button class="btn" hx-get="/user/show-all/delete" hx-target="#page-content">Benutzer löschen</button>
|
<button class="btn" hx-get="/show-all-users-delete" hx-target="#page-content">Benutzer löschen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
{{range .}}
|
{{range .}}
|
||||||
<button class="btn" hx-get="/article/review-deletion/{{.ID}}" hx-target="#page-content">
|
<button class="btn" hx-get="/review-article-for-deletion/{{.ID}}" hx-target="#page-content">
|
||||||
<h1 class="font-bold text-2xl">{{.Title}}</h1>
|
<h1 class="font-bold text-2xl">{{.Title}}</h1>
|
||||||
<p>{{.Description}}</p>
|
<p>{{.Description}}</p>
|
||||||
</button>
|
</button>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
{{range .RejectedArticles}}
|
{{range .RejectedArticles}}
|
||||||
{{if index $.MyIDs .ID}}
|
{{if index $.MyIDs .ID}}
|
||||||
<button class="btn" hx-get="/article/review-rejected/{{.ID}}" hx-target="#page-content">
|
<button class="btn" hx-get="/review-rejected-article/{{.ID}}" hx-target="#page-content">
|
||||||
<h1 class="font-bold text-2xl">{{.Title}}</h1>
|
<h1 class="font-bold text-2xl">{{.Title}}</h1>
|
||||||
<p>{{.Description}}</p>
|
<p>{{.Description}}</p>
|
||||||
</button>
|
</button>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Senden" hx-post="/article/resubmit/{{.Article.ID}}"
|
<input class="action-btn" type="submit" value="Senden" hx-post="/resubmit-article/{{.Article.ID}}"
|
||||||
hx-target="#page-content" />
|
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>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append('article-image', file);
|
formData.append('article-image', file);
|
||||||
|
|
||||||
fetch('/image/upload', {
|
fetch('/upload-image', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
{{range .Users}}
|
{{range .Users}}
|
||||||
<button class="btn" hx-get="/user/{{$.Action}}/{{.ID}}" hx-target="#page-content">
|
<button class="btn" hx-get="/{{$.Action}}/{{.ID}}" hx-target="#page-content">
|
||||||
<h1 class="font-bold text-2xl">
|
<h1 class="font-bold text-2xl">
|
||||||
{{.UserName}}
|
{{.UserName}}
|
||||||
({{if eq .Role 0}}
|
({{if eq .Role 0}}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Löschen" hx-get="/article/delete/{{.ID}}"
|
<input class="action-btn" type="submit" value="Löschen" hx-get="/delete-article/{{.ID}}"
|
||||||
hx-target="#page-content" />
|
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>
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Veröffentlichen" hx-get="/article/publish/{{.ID}}"
|
<input class="action-btn" type="submit" value="Veröffentlichen" hx-get="/publish-article/{{.ID}}"
|
||||||
hx-target="#page-content" />
|
hx-target="#page-content" />
|
||||||
<input class="btn" type="submit" value="Ablehnen" hx-get="/article/reject/{{.ID}}" 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>
|
</div>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
{{range .}}
|
{{range .}}
|
||||||
<button class="btn" hx-get="/article/review-unpublished/{{.ID}}" hx-target="#page-content">
|
<button class="btn" hx-get="/review-unpublished-article/{{.ID}}" hx-target="#page-content">
|
||||||
<h1 class="font-bold text-2xl">{{.Title}}</h1>
|
<h1 class="font-bold text-2xl">{{.Title}}</h1>
|
||||||
<p>{{.Description}}</p>
|
<p>{{.Description}}</p>
|
||||||
</button>
|
</button>
|
||||||
|
Reference in New Issue
Block a user