From ea81abb718a224269fce0092101413060a41c3a6 Mon Sep 17 00:00:00 2001 From: bronku Date: Sat, 1 Feb 2025 19:25:53 +0100 Subject: [PATCH] spellcheck, and refreshing cake list --- README.md | 6 ++---- handlers.go | 2 +- main.go | 7 +++---- public/new_order_form.html | 2 +- templates/cake.html | 8 -------- templates/cake_editor.html | 3 ++- templates/edit_cakes.html | 7 +++---- templates/new_cake.html | 7 +++++++ util.go | 2 +- 9 files changed, 20 insertions(+), 24 deletions(-) delete mode 100644 templates/cake.html create mode 100644 templates/new_cake.html diff --git a/README.md b/README.md index 0fbb047..b8ba9df 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ # iroon ## todo: - [x] extract order creation form into it's own element -- [ ] organize html structure - [x] option to add additional cakes - [x] saving orders on server - [ ] displaying orders - [x] move id to cake struct -- [ ] refresh the list on submission -- [ ] peristent storage +- [x] refresh the list on submission +- [ ] persistent storage - [x] rudimentary css -- [ ] organize the cake editor ## ux design ### adding an order: 1. user selects the _add order_ button diff --git a/handlers.go b/handlers.go index ae4febd..ced1503 100644 --- a/handlers.go +++ b/handlers.go @@ -60,7 +60,7 @@ func (c *controller) newCake(w http.ResponseWriter, r *http.Request) { } c.cakes[in.ID] = in - _ = c.tmpl["cake"].Execute(w, in) + _ = c.tmpl["new_cake"].Execute(w, in) } func (c *controller) postNewOrder(w http.ResponseWriter, r *http.Request) { diff --git a/main.go b/main.go index fb259a5..d49181f 100644 --- a/main.go +++ b/main.go @@ -3,15 +3,14 @@ package main import ( "embed" "fmt" - "os" - "net/http" + "os" _ "github.com/mattn/go-sqlite3" ) //go:embed public -var public embed.FS +//var public embed.FS //go:embed templates var templates embed.FS @@ -23,7 +22,7 @@ func main() { c.LoadRouter(publicfs) c.cakes = make(map[int]Cake) c.cakes[0] = Cake{"Sernik", 120, 0} - c.cakes[1] = Cake{"Malinowa chmórka", 120, 1} + c.cakes[1] = Cake{"Malinowa chmurka", 120, 1} c.cakes[2] = Cake{"Beza Pavlova", 8, 2} err := http.ListenAndServe(":8080", c) diff --git a/public/new_order_form.html b/public/new_order_form.html index b121989..5f6154a 100644 --- a/public/new_order_form.html +++ b/public/new_order_form.html @@ -27,5 +27,5 @@

Baset

-
+
\ No newline at end of file diff --git a/templates/cake.html b/templates/cake.html deleted file mode 100644 index 5ae36be..0000000 --- a/templates/cake.html +++ /dev/null @@ -1,8 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/templates/cake_editor.html b/templates/cake_editor.html index c0caffa..92d0445 100644 --- a/templates/cake_editor.html +++ b/templates/cake_editor.html @@ -1,3 +1,4 @@ +

Edit cakes

@@ -9,5 +10,5 @@
- +
\ No newline at end of file diff --git a/templates/edit_cakes.html b/templates/edit_cakes.html index 431ae4e..8d1ddbc 100644 --- a/templates/edit_cakes.html +++ b/templates/edit_cakes.html @@ -1,10 +1,9 @@

Edit cakes

- +
{{range $key, $value := .}} - {{end}} -
-
\ No newline at end of file + \ No newline at end of file diff --git a/templates/new_cake.html b/templates/new_cake.html new file mode 100644 index 0000000..13adab2 --- /dev/null +++ b/templates/new_cake.html @@ -0,0 +1,7 @@ +

Added cake

+ + \ No newline at end of file diff --git a/util.go b/util.go index 7a9afdf..5844a6e 100644 --- a/util.go +++ b/util.go @@ -7,7 +7,7 @@ import ( "strings" ) -func unwrap[T any](output T, err error) T { +func _[T any](output T, err error) T { if err != nil { panic(err) }