diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web/handlers.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index 78d4029..49f52ca 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -12,14 +12,27 @@ import ( func (app *application) listOperations(w http.ResponseWriter, r *http.Request) { - ops, err := app.operations.ListAll() + // ops, err := app.operations.ListAll() + + // if err != nil { + // app.serverError(w, r, err) + // return + // } + files := []string{ + "./ui/html/base.tmpl.html", + "./ui/html/pages/operations/list.tmpl.html", + "./ui/html/partials/nav.tmpl.html", + } + + ts, err := template.ParseFiles(files...) if err != nil { - app.serverError(w, r, err) + app.serverError(w, r, err) // Use the serverError() helper return } - for _, op := range ops { - fmt.Fprintf(w, "%+v\n", op) + err = ts.ExecuteTemplate(w, "base", nil) + if err != nil { + app.serverError(w, r, err) // Use the serverError() helper } } |