diff options
| -rw-r--r-- | handlers/shopping_list.go | 15 | ||||
| -rw-r--r-- | main.go | 5 | ||||
| -rw-r--r-- | templates/template.html | 24 |
3 files changed, 34 insertions, 10 deletions
diff --git a/handlers/shopping_list.go b/handlers/shopping_list.go index af07954..bdd7468 100644 --- a/handlers/shopping_list.go +++ b/handlers/shopping_list.go @@ -11,3 +11,18 @@ func LoadElements(c *gin.Context) { "Name": "Shopping List", }) } + +func CreateEntry(c *gin.Context) { + + c.Redirect(http.StatusFound, "/") +} + +func DeleteEntries(c *gin.Context) { + + c.Redirect(http.StatusFound, "/") +} + +func ToggleEntry(c *gin.Context) { + + c.Redirect(http.StatusFound, "/") +} diff --git a/main.go b/main.go index a2372f3..415c7bf 100644 --- a/main.go +++ b/main.go @@ -27,7 +27,10 @@ func main() { }) }) - r.GET("/shopping", shopping_list.LoadElements) + r.GET("/", shopping_list.LoadElements) + r.POST("/create", shopping_list.CreateEntry) + r.POST("/delete", shopping_list.DeleteEntries) + r.POST("/toggle", shopping_list.ToggleEntry) r.Run() } diff --git a/templates/template.html b/templates/template.html index 3223dd5..5504301 100644 --- a/templates/template.html +++ b/templates/template.html @@ -54,11 +54,6 @@ height: 25px; } - li > div { - display: flex; - align-items: center; - } - li.selected { text-decoration: line-through; color: #475258; @@ -172,8 +167,21 @@ <body> <div class="container"> <h1>{{ .Name }}</h1> - <ul class="checklist" id="checklist"></ul> + <ul class="checklist" id="checklist"> + <li>not selected</li> + <li> + test not selected + <form action="/toggle" method="POST"> + <input type="hidden" name="id" value="<test-id>" /> + <button type="submit" /> + </form> + </li> + + + <li class="selected">selected</li> + + </ul> <form action="/create" method="POST"> <div class="input-container"> @@ -182,9 +190,7 @@ </form> <form action="/delete" method="POST"> - <div class="buttons"> - <button type="submit" class="delete-button">Delete Selected Items</button> - </div> + <button type="submit" class="delete-button">Delete Selected Items</button> </form> </div> |