+// rowActions is a pencil and a bin, until the bin is tapped: then the row
+// asks. An icon is a smaller target to hit by accident than a word, and the
+// dish disappears from every picker the moment it goes.
+templ rowActions(v catalogView, editURL string, id int64, kind string) {
+ if v.DeleteID == id && v.DeleteKind == kind {
+
+ }
+}
+
+templ iconPencil() {
+
+}
+
+templ iconTrash() {
+
}
templ mainForm_(f mainForm) {
diff --git a/scripts/smoke.sh b/scripts/smoke.sh
index 336c87e..721feef 100755
--- a/scripts/smoke.sh
+++ b/scripts/smoke.sh
@@ -43,6 +43,16 @@ check() {
fi
}
+# refute
+refute() {
+ if printf '%s' "$2" | grep -qF -- "$3"; then
+ echo " FAIL $1 (should not contain: $3)"
+ fail=1
+ else
+ echo " ok $1"
+ fi
+}
+
echo "smoke: http://$addr"
check "unauthenticated request is refused" \
@@ -125,6 +135,11 @@ check "the saved day shows what was eaten" \
check "history is on the same page as the logger" \
"$(curl -s -u ":$pass" "http://$addr/")" "Aiemmin"
+# Deleting a logged meal drops the row outright, so it asks first.
+saved=$(curl -s -u ":$pass" "http://$addr/?pvm=2026-09-05&poista=1")
+check "deleting a meal asks first" "$saved" "Poistetaanko merkintä?"
+refute "and does not delete while asking" "$saved" "Ei merkintää"
+
check "deleting redirects back" \
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \
-d "pvm=2026-09-05" "http://$addr/poista")" "303"
@@ -196,14 +211,31 @@ check "adding a side redirects" \
check "the new side is listed" \
"$(curl -s -u ":$pass" "http://$addr/ruuat")" "Lohkoperunat"
-uusi=$(printf '%s' "$catalog" | grep -o 'muokkaa=[0-9]*' | head -n1 | cut -d= -f2)
+# The id of Uunikala specifically: the catalog is grouped and alphabetical, so
+# the first id on the page belongs to some other dish entirely.
+uusi=$(printf '%s' "$catalog" | grep -o 'Uunikala.*' | grep -o 'muokkaa=[0-9]*' | head -n1 | cut -d= -f2)
+if [ -z "$uusi" ]; then
+ echo " FAIL could not find Uunikala's id in the catalog"
+ fail=1
+ uusi=0
+fi
check "the edit form is prefilled" \
"$(curl -s -u ":$pass" "http://$addr/ruuat?muokkaa=$uusi")" "Muokkaa pääruokaa"
-check "deleting a main redirects" \
+# A bin icon is easy to hit by accident, so the row asks before anything goes.
+check "the bin asks before deleting" \
+ "$(curl -s -u ":$pass" "http://$addr/ruuat?poista=$uusi&tyyppi=paa")" "Poista?"
+
+check "the dish is still there while it asks" \
+ "$(curl -s -u ":$pass" "http://$addr/ruuat?poista=$uusi&tyyppi=paa")" "Uunikala"
+
+check "confirming the delete redirects" \
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \
-d "id=$uusi&tyyppi=paa" "http://$addr/ruuat/poista")" "303"
+refute "the dish is gone once confirmed" \
+ "$(curl -s -u ":$pass" "http://$addr/ruuat")" "Uunikala"
+
if [ "$fail" -ne 0 ]; then
echo "smoke: FAILED"
exit 1