diff --git a/web/server.go b/web/server.go index 278676e..c15c326 100644 --- a/web/server.go +++ b/web/server.go @@ -142,6 +142,9 @@ func (s *Server) routes() { // Main page s.router.Get("/", s.handleIndex()) + + // Add racers list route + s.router.Get("/admin/racers/list", s.handleRacersList()) } // Start starts the web server @@ -602,9 +605,11 @@ func (s *Server) handleCreateRacer() http.HandlerFunc { return } - // Return success - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, `{"id":%d}`, id) + s.logger.Info("Racer created", "id", id) + + // Return success message + w.Header().Set("Content-Type", "text/html") + w.Write([]byte(`
Heats saved successfully!
No racers added yet.
+| Name | +Car # | +Group | +Actions | +
|---|---|---|---|
| { racer.FirstName + " " + racer.LastName } | +{ racer.CarNumber } | +{ getGroupNameForRacer(groups, racer.GroupID) } | +
+
+
+
+
+ |
+
No racers added yet.
| Name | Car # | Group | Actions |
|---|---|---|---|
| ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var14 string + templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(racer.FirstName + " " + racer.LastName) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/admin.templ`, Line: 223, Col: 51} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " | ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var15 string + templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(racer.CarNumber) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/admin.templ`, Line: 224, Col: 28} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " | ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var16 string + templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(getGroupNameForRacer(groups, racer.GroupID)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/admin.templ`, Line: 225, Col: 56} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, " |