HTML-Seiten modularer aufgebaut und table.html hinzugefügt

This commit is contained in:
2023-10-07 18:32:33 +02:00
parent 8ae3019b9c
commit 15675d5e6c
6 changed files with 115 additions and 72 deletions

View File

@ -8,16 +8,22 @@ import (
"streifling.com/jason/sicherheitsunterweisung/packages/types"
)
func DisplayTable(bs *[]types.Briefing) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
template.Must(template.ParseFiles("templates/index.html", "templates/table.html")).Execute(w, bs)
}
}
func DisplayForm(i *int64) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
template.Must(template.ParseFiles("templates/form.html")).Execute(w, i)
template.Must(template.ParseFiles("templates/index.html", "templates/form.html")).Execute(w, i)
}
}
func AddParticipant(i *int64) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
*i++
template.Must(template.ParseFiles("templates/form.html", "templates/participant.html")).ExecuteTemplate(w, "participant", i)
template.Must(template.ParseFiles("templates/form.html")).ExecuteTemplate(w, "participant", i)
}
}