summaryrefslogtreecommitdiff
path: root/view/recipe.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-02-13 21:16:44 +0100
committerxengineering <me@xengineering.eu>2024-02-15 19:58:03 +0100
commit246687318e03fb649c30c4510e264e65b25ec6da (patch)
treee2cb89e19f68ca0bfaf040d6d6addbda1a470cda /view/recipe.go
parentbf0ad86df2e64191f6c430c328fee211ac3affa7 (diff)
downloadceres-246687318e03fb649c30c4510e264e65b25ec6da.tar
ceres-246687318e03fb649c30c4510e264e65b25ec6da.tar.zst
ceres-246687318e03fb649c30c4510e264e65b25ec6da.zip
view: Add edit view for model.Recipe type
Diffstat (limited to 'view/recipe.go')
-rw-r--r--view/recipe.go8
1 files changed, 7 insertions, 1 deletions
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