Fix item toggle
Christian Krinitsin mail@krinitsin.com
Wed, 17 Sep 2025 19:50:34 +0200
2 files changed,
3 insertions(+),
1 deletions(-)
M
handlers/shopping_list.go
→
handlers/shopping_list.go
@@ -103,6 +103,7 @@ }
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 @@ c.String(http.StatusInternalServerError, "Internal Server Error")
return } - entry.Checked = !entry.Checked + entry.Checked = checked[0] == 'f' err = models.DB. Save(&entry). Error
M
templates/template.html
→
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>