summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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>