diff --git a/components/createroomform.html b/components/createroomform.html
index 77d2200..872b077 100644
--- a/components/createroomform.html
+++ b/components/createroomform.html
@@ -1,24 +1,24 @@
{{define "createform"}}
-
- Create a room
- or
- @CustomBtn(templ.Attributes{"hx-get": "/room/hideform", "hx-target": ".create-room-div"}, "Hide Form")
-
-
-
- Hello, you should login.
-
+{{if .}}
+
+ Create a room
+ or
+
+
+
+{{else}}
+
+
+
+{{end}}
{{end}}
diff --git a/components/index.html b/components/index.html
index 1361feb..b93bd0d 100644
--- a/components/index.html
+++ b/components/index.html
@@ -43,7 +43,9 @@
{{template "login"}}
+
+
Word Color Cards
{{range $word, $color := .}}
diff --git a/handlers/elements.go b/handlers/elements.go
index 0ed89eb..e539df8 100644
--- a/handlers/elements.go
+++ b/handlers/elements.go
@@ -6,10 +6,21 @@ import (
)
func HandleShowCreateForm(w http.ResponseWriter, r *http.Request) {
+ show := true
tmpl, err := template.ParseGlob("components/*.html")
if err != nil {
abortWithError(w, err.Error())
return
}
- tmpl.ExecuteTemplate(w, "createform", nil)
+ tmpl.ExecuteTemplate(w, "createform", show)
+}
+
+func HandleHideCreateForm(w http.ResponseWriter, r *http.Request) {
+ show := false
+ tmpl, err := template.ParseGlob("components/*.html")
+ if err != nil {
+ abortWithError(w, err.Error())
+ return
+ }
+ tmpl.ExecuteTemplate(w, "createform", show)
}
diff --git a/main.go b/main.go
index 50e31eb..6fb3156 100644
--- a/main.go
+++ b/main.go
@@ -23,7 +23,9 @@ func ListenToRequests(port string) error {
mux.HandleFunc("GET /ping", handlers.HandlePing)
mux.HandleFunc("GET /", handlers.HandleHome)
mux.HandleFunc("POST /login", handlers.HandleFrontLogin)
+ //elements
mux.HandleFunc("GET /room/createform", handlers.HandleShowCreateForm)
+ mux.HandleFunc("GET /room/hideform", handlers.HandleHideCreateForm)
slog.Info("Listening", "addr", port)
return server.ListenAndServe()
}