From ce20e58eac9432721f281a351d4ebe4f870c9989 Mon Sep 17 00:00:00 2001
From: xengineering <me@xengineering.eu>
Date: Sat, 22 Apr 2023 20:30:46 +0200
Subject: Move delete button from edit page to recipe page

This reduces the number of clicks to delete a recipe.
---
 data/templates/recipe.html                  | 1 +
 data/templates/recipe_confirm_deletion.html | 3 +--
 data/templates/recipe_edit.html             | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/data/templates/recipe.html b/data/templates/recipe.html
index 21a6a15..bec6eb5 100644
--- a/data/templates/recipe.html
+++ b/data/templates/recipe.html
@@ -27,6 +27,7 @@
 			{{end}}
 
 			<a href="/recipe/edit?id={{.Id}}"><button>edit</button></a>
+			<a href="/recipe/confirm-deletion?id={{.Id}}"><button style="background-color:red">delete</button></a>
 
 			{{ template "footer.html" }}
 		</main>
diff --git a/data/templates/recipe_confirm_deletion.html b/data/templates/recipe_confirm_deletion.html
index d247b13..17c4da8 100644
--- a/data/templates/recipe_confirm_deletion.html
+++ b/data/templates/recipe_confirm_deletion.html
@@ -14,10 +14,9 @@
 		</header>
 
 		<main>
-			<p>Recipe ID: {{.Id}}</p>
 			<p>Do you really want to delete this recipe?</p>
 			<form action="/recipe/confirm-deletion?id={{.Id}}" method="POST">
-				<a href="/recipe/edit?id={{.Id}}"><button type="button">cancel</button></a>
+				<a href="/recipe?id={{.Id}}"><button type="button">cancel</button></a>
 				<button style="background-color:red" type="submit">delete</button>
 			</form>
 			{{ template "footer.html" }}
diff --git a/data/templates/recipe_edit.html b/data/templates/recipe_edit.html
index af9eb88..fc1d74c 100644
--- a/data/templates/recipe_edit.html
+++ b/data/templates/recipe_edit.html
@@ -17,7 +17,6 @@
 			<pre contenteditable="true" id="editor">{{.Text}}</pre>
 			<button onclick="save()">save</button>
 			<a href="/recipe?id={{.Id}}"><button>back</button></a>
-			<a href="/recipe/confirm-deletion?id={{.Id}}"><button style="background-color:red">delete</button></a>
 			{{ template "footer.html" }}
 		</main>
 
-- 
cgit v1.2.3-70-g09d2