making it work
This commit is contained in:
Vendored
+1
File diff suppressed because one or more lines are too long
+2
-3
@@ -23,9 +23,8 @@ func updateStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
println("changing status")
|
||||
|
||||
queryParams := r.URL.Query()
|
||||
h_status := queryParams.Get("statush")
|
||||
a_status := queryParams.Get("statusa")
|
||||
a_status := r.FormValue("statusa")
|
||||
h_status := r.FormValue("statush")
|
||||
|
||||
statusOne = h_status
|
||||
statusTwo = a_status
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package templates
|
||||
|
||||
templ Hello(name string) {
|
||||
<head>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.5" integrity="sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
|
||||
<div>Hello, { name }</div>
|
||||
|
||||
<button hx-post="/" hx-target="body">test</button>
|
||||
}
|
||||
|
||||
@@ -22,21 +22,48 @@ func Hello(name string) templ.Component {
|
||||
var_1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, err = templBuffer.WriteString("<div>")
|
||||
_, err = templBuffer.WriteString("<head><script src=\"https://cdn.tailwindcss.com\">")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var_2 := `Hello, `
|
||||
var_2 := ``
|
||||
_, err = templBuffer.WriteString(var_2)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var var_3 string = name
|
||||
_, err = templBuffer.WriteString(templ.EscapeString(var_3))
|
||||
_, err = templBuffer.WriteString("</script><script src=\"https://unpkg.com/htmx.org@1.9.5\" integrity=\"sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO\" crossorigin=\"anonymous\">")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</div>")
|
||||
var_3 := ``
|
||||
_, err = templBuffer.WriteString(var_3)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</script></head><div>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var_4 := `Hello, `
|
||||
_, err = templBuffer.WriteString(var_4)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var var_5 string = name
|
||||
_, err = templBuffer.WriteString(templ.EscapeString(var_5))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</div><button hx-post=\"/\" hx-target=\"body\">")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var_6 := `test`
|
||||
_, err = templBuffer.WriteString(var_6)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</button>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package templates
|
||||
|
||||
templ GetStatus(statusOne string, statusTwo string) {
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<div id="main" class="flex flex-row gap-2">
|
||||
<script src="https://unpkg.com/htmx.org@1.9.5" integrity="sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
|
||||
<form
|
||||
id="form"
|
||||
hx-post="/changestatus"
|
||||
hx-target="#main"
|
||||
hx-swap="outerHTML"
|
||||
hx-select="#form" hx-swap="outerHTML"
|
||||
>
|
||||
<input
|
||||
id="statusH" name="statush" type="text"
|
||||
@@ -22,5 +26,5 @@ templ GetStatus(statusOne string, statusTwo string) {
|
||||
|
||||
<button type="submit" class="button is-primary">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func GetStatus(statusOne string, statusTwo string) templ.Component {
|
||||
var_1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, err = templBuffer.WriteString("<script src=\"https://cdn.tailwindcss.com\">")
|
||||
_, err = templBuffer.WriteString("<html><head><script src=\"https://cdn.tailwindcss.com\">")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -31,7 +31,16 @@ func GetStatus(statusOne string, statusTwo string) templ.Component {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</script><div id=\"main\" class=\"flex flex-row gap-2\"><form hx-post=\"/changestatus\" hx-target=\"#main\" hx-swap=\"outerHTML\"><input id=\"statusH\" name=\"statush\" type=\"text\" placeholder=\"Enter status H\" value=\"")
|
||||
_, err = templBuffer.WriteString("</script><script src=\"https://unpkg.com/htmx.org@1.9.5\" integrity=\"sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO\" crossorigin=\"anonymous\">")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var_3 := ``
|
||||
_, err = templBuffer.WriteString(var_3)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</script></head><form id=\"form\" hx-post=\"/changestatus\" hx-select=\"#form\" hx-swap=\"outerHTML\"><input id=\"statusH\" name=\"statush\" type=\"text\" placeholder=\"Enter status H\" value=\"")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -51,12 +60,12 @@ func GetStatus(statusOne string, statusTwo string) templ.Component {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var_3 := `Update`
|
||||
_, err = templBuffer.WriteString(var_3)
|
||||
var_4 := `Update`
|
||||
_, err = templBuffer.WriteString(var_4)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</button></form></div>")
|
||||
_, err = templBuffer.WriteString("</button></form></html>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user