summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-09-17 19:50:34 +0200
committerckrinitsin <101062646+ckrinitsin@users.noreply.github.com>2025-09-17 19:52:46 +0200
commit723d19d5ee37e607c4c4d9c7b4450b7f8a5aa543 (patch)
tree61729dc1a0a77db955699278a547ecd3fb9452f1
parentd24932bcf42ae2af9a01590554d889c2dbe22778 (diff)
downloadshopping-list-master.tar.gz
shopping-list-master.zip
Fix item toggle HEAD master
-rw-r--r--handlers/shopping_list.go3
-rw-r--r--templates/template.html1
2 files changed, 3 insertions, 1 deletions
diff --git a/handlers/shopping_list.go b/handlers/shopping_list.go
index a1b90ff..57b3d1e 100644
--- a/handlers/shopping_list.go
+++ b/handlers/shopping_list.go
@@ -103,6 +103,7 @@ func DeleteEntries(c *gin.Context) {
 
 func ToggleEntry(c *gin.Context) {
 	id := c.PostForm("id")
+	checked := c.PostForm("checked")
 
 	any_list, ok := c.Get("current_list")
 	if !ok {
@@ -128,7 +129,7 @@ func ToggleEntry(c *gin.Context) {
 		return
 	}
 
-	entry.Checked = !entry.Checked
+	entry.Checked = checked[0] == 'f'
 	err = models.DB.
 		Save(&entry).
 		Error
diff --git a/templates/template.html b/templates/template.html
index b92f716..861e43d 100644
--- a/templates/template.html
+++ b/templates/template.html
@@ -178,6 +178,7 @@
                 {{ .Text }}
                 <form action="{{ $.base_path }}toggle" method="POST">
                     <input type="hidden" name="id" value="{{ .ID }}" />
+                    <input type="hidden" name="checked" value="{{ .Checked }}" />
                     <button type="submit" />
                 </form>
                 </li>