From 246687318e03fb649c30c4510e264e65b25ec6da Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 13 Feb 2024 21:16:44 +0100 Subject: view: Add edit view for model.Recipe type --- view/recipe.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'view/recipe.go') diff --git a/view/recipe.go b/view/recipe.go index 3739143..b0525a1 100644 --- a/view/recipe.go +++ b/view/recipe.go @@ -22,7 +22,13 @@ func Recipe(w http.ResponseWriter, r *http.Request) { return } - err = html.ExecuteTemplate(w, "recipe", recipe) + tmpl := "recipe" + edit, ok := r.URL.Query()["edit"] + if ok && len(edit) == 1 && edit[0] == "true" { + tmpl = "recipe-edit" + } + + err = html.ExecuteTemplate(w, tmpl, recipe) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return -- cgit v1.2.3-70-g09d2