index — shopping-list @ 723d19d5ee37e607c4c4d9c7b4450b7f8a5aa543

web application, written in go using gin

Fix item toggle
Christian Krinitsin mail@krinitsin.com
Wed, 17 Sep 2025 19:50:34 +0200
commit

723d19d5ee37e607c4c4d9c7b4450b7f8a5aa543

parent

d24932bcf42ae2af9a01590554d889c2dbe22778

2 files changed, 3 insertions(+), 1 deletions(-)

jump to
M handlers/shopping_list.gohandlers/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.htmltemplates/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>