diff --git a/main.go b/main.go index bb28da0..7de6c65 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ type Person struct { type Instructor Person type Participant struct { + id int64 Person Company string } @@ -29,13 +30,15 @@ type Briefing struct { func main() { mux := http.NewServeMux() + i := 1 mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/")))) mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - template.Must(template.ParseFiles("templates/index.html")).Execute(w, nil) + template.Must(template.ParseFiles("templates/index.html")).Execute(w, i) }) mux.HandleFunc("/add-participant/", func(w http.ResponseWriter, r *http.Request) { - template.Must(template.ParseFiles("templates/index.html", "templates/participant.html")).ExecuteTemplate(w, "participant", nil) + i++ + template.Must(template.ParseFiles("templates/index.html", "templates/participant.html")).ExecuteTemplate(w, "participant", i) }) log.Fatalln(http.ListenAndServe(":8080", mux)) diff --git a/templates/index.html b/templates/index.html index 6189fb7..e63adc4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -38,19 +38,21 @@ + -
- - +
+ + - - + + - - + +
- +