restructure routes
This commit is contained in:
parent
be467521d9
commit
cddd88d2f6
60
cmd/main.go
60
cmd/main.go
@ -49,42 +49,42 @@ 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 /article/all-rejected", f.ShowRejectedArticles(config, db, store))
|
||||||
|
mux.HandleFunc("GET /article/all-unpublished", f.ShowUnpublishedArticles(config, db, store))
|
||||||
|
mux.HandleFunc("GET /article/delete/{id}", f.DeleteArticle(config, db, store))
|
||||||
|
mux.HandleFunc("GET /article/publish/{id}", f.PublishArticle(config, db, store))
|
||||||
|
mux.HandleFunc("GET /article/reject/{id}", f.RejectArticle(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/serve/{id}", c.ServeArticle(config, db))
|
||||||
mux.HandleFunc("GET /create-tag", f.CreateTag(config, store))
|
mux.HandleFunc("GET /article/write", f.WriteArticle(config, db, store))
|
||||||
mux.HandleFunc("GET /create-user", f.CreateUser(config, store))
|
|
||||||
mux.HandleFunc("GET /delete-article/{id}", f.DeleteArticle(config, db, store))
|
|
||||||
mux.HandleFunc("GET /delete-user/{id}", f.DeleteUser(config, db, store))
|
|
||||||
mux.HandleFunc("GET /edit-self", f.EditSelf(config, db, store))
|
|
||||||
mux.HandleFunc("GET /edit-user/{id}", f.EditUser(config, db, store))
|
|
||||||
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
mux.HandleFunc("GET /hub", f.ShowHub(config, db, 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/{id}", c.ServePDF(config))
|
mux.HandleFunc("GET /pdf/serve/{id}", c.ServePDF(config))
|
||||||
mux.HandleFunc("GET /pics/{pic}", f.ServeImage(config, store))
|
mux.HandleFunc("GET /pic/serve/{pic}", f.ServeImage(config, store))
|
||||||
mux.HandleFunc("GET /publish-article/{id}", f.PublishArticle(config, db, store))
|
mux.HandleFunc("GET /rss/serve", c.ServeRSS(config))
|
||||||
mux.HandleFunc("GET /publish-issue", f.PublishLatestIssue(config, db, store))
|
mux.HandleFunc("GET /tag/create", f.CreateTag(config, store))
|
||||||
mux.HandleFunc("GET /published-articles", f.ShowPublishedArticles(config, db, store))
|
mux.HandleFunc("GET /user/create", f.CreateUser(config, store))
|
||||||
mux.HandleFunc("GET /reject-article/{id}", f.RejectArticle(config, db, store))
|
mux.HandleFunc("GET /user/delete/{id}", f.DeleteUser(config, db, store))
|
||||||
mux.HandleFunc("GET /rejected-articles", f.ShowRejectedArticles(config, db, store))
|
mux.HandleFunc("GET /user/edit/{id}", f.EditUser(config, db, store))
|
||||||
mux.HandleFunc("GET /review-article-for-deletion/{id}", f.ReviewArticleForDeletion(config, db, store))
|
mux.HandleFunc("GET /user/edit/self", f.EditSelf(config, db, store))
|
||||||
mux.HandleFunc("GET /review-rejected-article/{id}", f.ReviewRejectedArticle(config, db, store))
|
mux.HandleFunc("GET /user/show-all/delete", f.ShowAllUsers(config, db, store, "delete-user"))
|
||||||
mux.HandleFunc("GET /review-unpublished-article/{id}", f.ReviewUnpublishedArticle(config, db, store))
|
mux.HandleFunc("GET /user/show-all/edit", f.ShowAllUsers(config, db, store, "edit-user"))
|
||||||
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 /add-first-user", f.AddFirstUser(config, db, store))
|
mux.HandleFunc("POST /article/resubmit/{id}", f.ResubmitArticle(config, db, store))
|
||||||
mux.HandleFunc("POST /add-tag", f.AddTag(config, db, store))
|
mux.HandleFunc("POST /article/submit", f.SubmitArticle(config, db, 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 /resubmit-article/{id}", f.ResubmitArticle(config, db, store))
|
mux.HandleFunc("POST /pic/upload", f.UploadImage(config, store))
|
||||||
mux.HandleFunc("POST /submit-article", f.SubmitArticle(config, db, store))
|
mux.HandleFunc("POST /tag/add", f.AddTag(config, db, store))
|
||||||
mux.HandleFunc("POST /update-self", f.UpdateSelf(config, db, store))
|
mux.HandleFunc("POST /user/add", f.AddUser(config, db, store))
|
||||||
mux.HandleFunc("POST /update-user/{id}", f.UpdateUser(config, db, store))
|
mux.HandleFunc("POST /user/add-first", f.AddFirstUser(config, db, store))
|
||||||
mux.HandleFunc("POST /upload-image", f.UploadImage(config, store))
|
mux.HandleFunc("POST /user/update/{id}", f.UpdateUser(config, db, store))
|
||||||
|
mux.HandleFunc("POST /user/update/self", f.UpdateSelf(config, db, store))
|
||||||
|
|
||||||
log.Fatalln(http.ListenAndServe(config.Port, mux))
|
log.Fatalln(http.ListenAndServe(config.Port, mux))
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Anlegen" hx-post="/add-user" hx-target="#page-content" />
|
<input class="action-btn" type="submit" value="Anlegen" hx-post="/user/add" 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="/publish-issue" hx-target="#page-content">Ausgabe publizieren</button>
|
<button class="action-btn" hx-get="/issue/publish" 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="/update-self"
|
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/user/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="/update-user/{{.ID}}"
|
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/user/update/{{.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="/submit-article" hx-target="#page-content" />
|
<input class="action-btn" type="submit" value="Senden" hx-post="/article/submit" 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('/upload-image', {
|
fetch('/pic/upload', {
|
||||||
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="/add-first-user" hx-target="#page-content" />
|
<input class="action-btn" type="submit" value="Anlegen" hx-post="/user/add-first" hx-target="#page-content" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -6,10 +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="/write-article" hx-target="#page-content">Artikel schreiben</button>
|
<button class="btn" hx-get="/article/write" hx-target="#page-content">Artikel schreiben</button>
|
||||||
<button class="btn" hx-get="/rejected-articles" hx-target="#page-content">Abgelehnte Artikel</button>
|
<button class="btn" hx-get="/articles/all-rejected" hx-target="#page-content">Abgelehnte Artikel</button>
|
||||||
<a class="btn text-center" href="/rss">RSS Feed</a>
|
<a class="btn text-center" href="/rss">RSS Feed</a>
|
||||||
<button class="btn" hx-get="/edit-self" hx-target="#page-content">Profil bearbeiten</button>
|
<button class="btn" hx-get="/user/edit/self" hx-target="#page-content">Profil bearbeiten</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -18,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="/unpublished-articles" hx-target="#page-content">
|
<button class="btn" hx-get="/article/all-unpublished" hx-target="#page-content">
|
||||||
Unveröffentlichte Artikel
|
Unveröffentlichte Artikel
|
||||||
</button>
|
</button>
|
||||||
<button class="btn" hx-get="/create-tag" hx-target="#page-content">Neuer Tag</button>
|
<button class="btn" hx-get="/tag/create" hx-target="#page-content">Neuer Tag</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -30,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="/this-issue" hx-target="#page-content">Diese Ausgabe</button>
|
<button class="btn" hx-get="/issue/this" hx-target="#page-content">Diese Ausgabe</button>
|
||||||
<button class="btn" hx-get="/published-articles" hx-target="#page-content">Artikel löschen</button>
|
<button class="btn" hx-get="/article/all-published" hx-target="#page-content">Artikel löschen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -40,9 +40,9 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<h2>Administrator</h2>
|
<h2>Administrator</h2>
|
||||||
<div class="grid grid-cols-3 gap-4">
|
<div class="grid grid-cols-3 gap-4">
|
||||||
<button class="btn" hx-get="/create-user" hx-target="#page-content">Benutzer hinzufügen</button>
|
<button class="btn" hx-get="/user/create" hx-target="#page-content">Benutzer hinzufügen</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/edit" hx-target="#page-content">Benutzer bearbeiten</button>
|
||||||
<button class="btn" hx-get="/show-all-users-delete" hx-target="#page-content">Benutzer löschen</button>
|
<button class="btn" hx-get="/user/show-all/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="/review-article-for-deletion/{{.ID}}" hx-target="#page-content">
|
<button class="btn" hx-get="/article/review-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>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
<input class="action-btn" type="submit" value="Senden" hx-post="/resubmit-article/{{.Article.ID}}"
|
<input class="action-btn" type="submit" value="Senden" hx-post="/article/resubmit/{{.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('/upload-image', {
|
fetch('/pic/upload', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
|
@ -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="/delete-article/{{.ID}}"
|
<input class="action-btn" type="submit" value="Löschen" hx-get="/article/delete/{{.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="/publish-article/{{.ID}}"
|
<input class="action-btn" type="submit" value="Veröffentlichen" hx-get="/article/publish/{{.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" />
|
<input class="btn" type="submit" value="Ablehnen" hx-get="/article/reject/{{.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="/review-unpublished-article/{{.ID}}" hx-target="#page-content">
|
<button class="btn" hx-get="/article/review-unpublished/{{.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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user