mirror of
https://github.com/joerdav/go-htmx-examples.git
synced 2025-11-23 15:52:27 +00:00
chore: click to edit
This commit is contained in:
@@ -17,6 +17,7 @@ var demoUser user = user{
|
||||
|
||||
func Handlers(prefix string, mux *http.ServeMux) {
|
||||
mux.HandleFunc(prefix+"/", index)
|
||||
mux.HandleFunc(prefix, index)
|
||||
mux.HandleFunc(prefix+"/contact/1", putUser)
|
||||
mux.HandleFunc(prefix+"/contact/1/edit", editForm)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ templ Form(u user) {
|
||||
</div>
|
||||
<div class="field is-grouped">
|
||||
<div class="control"><button class="button is-black">Submit</button></div>
|
||||
<div class="control"><button class="button" hx-get="/click-to-edit/contact/1">Cancel</button></div>
|
||||
<div class="control"><button class="button" hx-get="/click-to-edit">Cancel</button></div>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ func Form(u user) templ.Component {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString(" hx-get=\"/click-to-edit/contact/1\"")
|
||||
_, err = templBuffer.WriteString(" hx-get=\"/click-to-edit\"")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user