Changed URL patterns to be more specific
This commit is contained in:
parent
ca70fa6d4d
commit
a3c53b1b20
46
cmd/main.go
46
cmd/main.go
@ -49,36 +49,36 @@ func main() {
|
||||
http.FileServer(http.Dir(args.WebDir+"/static/"))))
|
||||
mux.HandleFunc("/", view.HomePage(args, db, store))
|
||||
|
||||
mux.HandleFunc("GET /create-tag/", view.CreateTag(args))
|
||||
mux.HandleFunc("GET /create-user/", view.CreateUser(args))
|
||||
mux.HandleFunc("GET /edit-user/", view.EditUser(args, db, store))
|
||||
mux.HandleFunc("GET /hub/", view.ShowHub(args, db, 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 /reject-article/{id}/", view.RejectArticle(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-unpublished-article/{id}/", view.ReviewUnpublishedArticle(args, db, store))
|
||||
mux.HandleFunc("GET /rss/", view.ShowRSS(
|
||||
mux.HandleFunc("GET /create-tag", view.CreateTag(args))
|
||||
mux.HandleFunc("GET /create-user", view.CreateUser(args))
|
||||
mux.HandleFunc("GET /edit-user", view.EditUser(args, db, store))
|
||||
mux.HandleFunc("GET /hub", view.ShowHub(args, db, 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 /reject-article/{id}", view.RejectArticle(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-unpublished-article/{id}", view.ReviewUnpublishedArticle(args, db, store))
|
||||
mux.HandleFunc("GET /rss", view.ShowRSS(
|
||||
args,
|
||||
db,
|
||||
"Freimaurer Distrikt Niedersachsen und Sachsen-Anhalt",
|
||||
"https://distrikt-ni-st.de",
|
||||
"Freiheit, Gleichheit, Brüderlichkeit, Toleranz und Humanität",
|
||||
))
|
||||
mux.HandleFunc("GET /this-issue/", view.ShowCurrentArticles(args, db))
|
||||
mux.HandleFunc("GET /unpublished-articles/", view.ShowUnpublishedArticles(args, db))
|
||||
mux.HandleFunc("GET /write-article/", view.WriteArticle(args, db))
|
||||
mux.HandleFunc("GET /this-issue", view.ShowCurrentArticles(args, db))
|
||||
mux.HandleFunc("GET /unpublished-articles", view.ShowUnpublishedArticles(args, db))
|
||||
mux.HandleFunc("GET /write-article", view.WriteArticle(args, db))
|
||||
|
||||
mux.HandleFunc("POST /add-first-user/", view.AddFirstUser(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 /login/", view.Login(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 /update-user/", view.UpdateUser(args, db, store))
|
||||
mux.HandleFunc("POST /upload-image/", view.UploadImage(args))
|
||||
mux.HandleFunc("POST /add-first-user", view.AddFirstUser(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 /login", view.Login(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 /update-user", view.UpdateUser(args, db, store))
|
||||
mux.HandleFunc("POST /upload-image", view.UploadImage(args))
|
||||
|
||||
log.Fatalln(http.ListenAndServe(args.Port, mux))
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
<form>
|
||||
<input required name="tag" placeholder="Tag eingeben" type="text" />
|
||||
<div class="btn-area">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -44,8 +44,8 @@
|
||||
</div>
|
||||
|
||||
<div class="btn-area">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
|
||||
<div class="btn-area">
|
||||
<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="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>
|
||||
</div>
|
||||
{{end}}
|
||||
|
@ -28,9 +28,9 @@
|
||||
</div>
|
||||
|
||||
<div class="btn-area">
|
||||
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/update-user/"
|
||||
<input class="action-btn" type="submit" value="Aktualisieren" hx-post="/update-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>
|
||||
</form>
|
||||
{{end}}
|
||||
|
@ -27,13 +27,13 @@
|
||||
</div>
|
||||
|
||||
<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"
|
||||
hx-swap="beforeend" hx-target="#editor-images" />
|
||||
</div>
|
||||
|
||||
<div class="btn-area">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
</div>
|
||||
|
||||
<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="/add-first-user" hx-target="#page-content" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
{{define "page-content"}}
|
||||
<div class="flex flex-col gap-4">
|
||||
<button class="btn" hx-get="/logout/" hx-target="#page-content">Abmelden</button>
|
||||
<button class="btn" hx-get="/logout" hx-target="#page-content">Abmelden</button>
|
||||
|
||||
<div class="mb-3">
|
||||
<h2>Autor</h2>
|
||||
<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="/rejected-articles/" hx-target="#page-content">Abgelehnte Artikel</button>
|
||||
<button class="btn" hx-get="/rss/" hx-target="#page-content">RSS Feed</button>
|
||||
<button class="btn" hx-get="/edit-user/" hx-target="#page-content">Benutzer bearbeiten</button>
|
||||
<button class="btn" hx-get="/write-article" 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="/rss" hx-target="#page-content">RSS Feed</button>
|
||||
<button class="btn" hx-get="/edit-user" hx-target="#page-content">Benutzer bearbeiten</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
<div class="mb-3">
|
||||
<h2>Redakteur</h2>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<button class="btn" hx-get="/unpublished-articles/" hx-target="#page-content">
|
||||
<button class="btn" hx-get="/unpublished-articles" hx-target="#page-content">
|
||||
Unveröffentlichte Artikel
|
||||
</button>
|
||||
<button class="btn" hx-get="/create-tag/" hx-target="#page-content">Neuer Tag</button>
|
||||
<button class="btn" hx-get="/create-tag" hx-target="#page-content">Neuer Tag</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@ -28,7 +28,7 @@
|
||||
<div class="mb-3">
|
||||
<h2>Herausgeber</h2>
|
||||
<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="/this-issue" hx-target="#page-content">Diese Ausgabe</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@ -37,7 +37,7 @@
|
||||
<div class="mb-3">
|
||||
<h2>Administrator</h2>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<button class="btn" hx-get="/create-user/" hx-target="#page-content">Benutzer hinzufügen</button>
|
||||
<button class="btn" hx-get="/create-user" hx-target="#page-content">Benutzer hinzufügen</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
@ -6,6 +6,6 @@
|
||||
<input class="w-full" name="password" placeholder="Passwort" type="password" />
|
||||
</div>
|
||||
|
||||
<input class="action-btn" type="submit" value="Anmelden" hx-post="/login/" hx-target="#page-content" />
|
||||
<input class="action-btn" type="submit" value="Anmelden" hx-post="/login" hx-target="#page-content" />
|
||||
</form>
|
||||
{{end}}
|
||||
|
@ -2,13 +2,13 @@
|
||||
<div class="flex flex-col gap-4">
|
||||
{{range .RejectedArticles}}
|
||||
{{if index $.MyIDs .ID}}
|
||||
<button class="btn" hx-get="/review-rejected-article/{{.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>
|
||||
<p>{{.Description}}</p>
|
||||
</button>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
<button class="action-btn" hx-get="/hub/" hx-target="#page-content">Zurück</button>
|
||||
<button class="action-btn" hx-get="/hub" hx-target="#page-content">Zurück</button>
|
||||
</div>
|
||||
{{end}}
|
||||
|
@ -28,14 +28,14 @@
|
||||
</div>
|
||||
|
||||
<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"
|
||||
hx-swap="beforeend" hx-target="#editor-images" />
|
||||
</div>
|
||||
|
||||
<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="/resubmit-article/{{.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>
|
||||
</form>
|
||||
|
||||
|
@ -26,10 +26,10 @@
|
||||
</div>
|
||||
|
||||
<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="/publish-article/{{.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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{define "page-content"}}
|
||||
<div class="flex flex-col gap-4">
|
||||
{{range .}}
|
||||
<button class="btn" hx-get="/review-unpublished-article/{{.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>
|
||||
<p>{{.Description}}</p>
|
||||
</button>
|
||||
{{end}}
|
||||
<button class="action-btn" hx-get="/hub/" hx-target="#page-content">Zurück</button>
|
||||
<button class="action-btn" hx-get="/hub" hx-target="#page-content">Zurück</button>
|
||||
</div>
|
||||
{{end}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user