Erzeuge Templates zentral und nicht pro Aufruf
This commit is contained in:
parent
886ccc0dcb
commit
43b3631da2
7 changed files with 32 additions and 45 deletions
|
@ -2,7 +2,6 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"sprechstundentool/models"
|
||||
"strconv"
|
||||
|
@ -19,8 +18,7 @@ func (b *BaseHandler) DeleteOfficeHourHandler(w http.ResponseWriter, req *http.R
|
|||
w.WriteHeader(http.StatusBadRequest)
|
||||
}
|
||||
_, err = b.requestRepo.Add(officeHour, models.RequestDelete)
|
||||
tmpl, _ := template.New("deleteSuccess.html").ParseFiles("templates/deleteSuccess.html")
|
||||
tmpl.Execute(w, struct{}{})
|
||||
Templates.ExecuteTemplate(w, "deleteSuccess.html", struct{}{})
|
||||
} else {
|
||||
officeHours, _ := b.officeHourRepo.GetAll(true)
|
||||
timetable, slots := GetTimetable(officeHours)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue