summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/handlers/elements.go22
-rw-r--r--internal/models/models.go1
-rw-r--r--internal/server/router.go4
3 files changed, 27 insertions, 0 deletions
diff --git a/internal/handlers/elements.go b/internal/handlers/elements.go
new file mode 100644
index 0000000..c0da7f0
--- /dev/null
+++ b/internal/handlers/elements.go
@@ -0,0 +1,22 @@
+package handlers
+
+import (
+ "html/template"
+ "net/http"
+)
+
+func (h *Handlers) ServeShowForm(w http.ResponseWriter, r *http.Request) {
+ tmpl, err := template.ParseGlob("components/*.html")
+ if err != nil {
+ panic(err)
+ }
+ tmpl.ExecuteTemplate(w, "actionform", nil)
+}
+
+func (h *Handlers) ServeHideForm(w http.ResponseWriter, r *http.Request) {
+ tmpl, err := template.ParseGlob("components/*.html")
+ if err != nil {
+ panic(err)
+ }
+ tmpl.ExecuteTemplate(w, "showformbtn", nil)
+}
diff --git a/internal/models/models.go b/internal/models/models.go
index 42990a3..5d6dfa6 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -21,5 +21,6 @@ type (
Magnitude uint8
Repeatable bool
Type ActionType
+ Done bool
}
)
diff --git a/internal/server/router.go b/internal/server/router.go
index 9b03371..726f8b8 100644
--- a/internal/server/router.go
+++ b/internal/server/router.go
@@ -23,6 +23,10 @@ func (srv *server) ListenToRequests() {
mux.HandleFunc("GET /", h.MainPage)
mux.HandleFunc("POST /", h.HandleForm)
+ // ====== elements ======
+ mux.HandleFunc("GET /showform", h.ServeShowForm)
+ mux.HandleFunc("GET /hideform", h.ServeHideForm)
+
fmt.Printf("Listening on %v\n", server.Addr)
server.ListenAndServe()
}