Guestbook Admin handlers.
This commit is contained in:
parent
3c47d42ba7
commit
790c866456
@ -160,6 +160,56 @@ func (h *Handlers) GuestbookPost(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/guestbook", http.StatusMovedPermanently)
|
||||
}
|
||||
|
||||
func (h *Handlers) GuestbookAdmin(w http.ResponseWriter, r *http.Request) {
|
||||
entriesCount, _ := h.guestbookDB.Count()
|
||||
entries, err := h.guestbookDB.Entries(1, entriesCount)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
web.GuestbookAdmin("/ Guestbook Administration", h.guestbookOwner, entries, r, w)
|
||||
}
|
||||
|
||||
func (h *Handlers) GuestbookAdminDeleteEntry(w http.ResponseWriter, r *http.Request) {
|
||||
id, err := strconv.ParseInt(GetURLParam(r, "id"), 10, 64)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = h.guestbookDB.DeleteEntry(id)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handlers) GuestbookAdminUpdateEntry(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handlers) GuestbookAdminNewEntry(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handlers) GuestbookAdminDeleteReply(w http.ResponseWriter, r *http.Request) {
|
||||
id, err := strconv.ParseInt(GetURLParam(r, "id"), 10, 64)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
err = h.guestbookDB.DeleteReply(id)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handlers) GuestbookAdminUpdateReply(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handlers) GuestbookAdminNewReply(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handlers) RSS(w http.ResponseWriter, r *http.Request) {
|
||||
posts := []mindflow.Post{
|
||||
{Category: "Kek", Date: time.Now(), Title: "LMAO", Body: "Testing!"},
|
||||
|
Loading…
Reference in New Issue
Block a user