rework template rendering, cache parsed templates
adapt error wrapping principle
This commit is contained in:
parent
7a1448d6f9
commit
f04396809d
21 changed files with 175 additions and 82 deletions
|
@ -4,10 +4,13 @@ package controllers
|
|||
import (
|
||||
"net/http"
|
||||
"officeHours/models"
|
||||
"officeHours/templating"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func (b *BaseHandler) DeleteOfficeHourHandler(w http.ResponseWriter, req *http.Request) {
|
||||
// TODO: error handling here is by no means sufficient, furthermore
|
||||
// 400 BadRequest is for technically wrong stuff (most promimently GET instead of POST)
|
||||
if req.FormValue("id") != "" {
|
||||
id, err := strconv.Atoi(req.FormValue("id"))
|
||||
if err != nil {
|
||||
|
@ -18,7 +21,7 @@ func (b *BaseHandler) DeleteOfficeHourHandler(w http.ResponseWriter, req *http.R
|
|||
w.WriteHeader(http.StatusBadRequest)
|
||||
}
|
||||
_, err = b.requestRepo.Add(officeHour, models.RequestDelete)
|
||||
b.serveTemplate(w, "deleteSuccess", nil)
|
||||
templating.ServeTemplate(w, "deleteSuccess", nil)
|
||||
} else {
|
||||
officeHours, _ := b.officeHourRepo.GetAll(true)
|
||||
timetable, slots := b.GetTimetable(officeHours)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue