Add hydration (refresh) support to user pages
Peter Sanchez pjs@petersanchez.com
Wed, 27 Apr 2022 19:11:47 -0600
2 files changed,
8 insertions(+),
0 deletions(-)
M
views/honkpage.js
→
views/honkpage.js
@@ -148,6 +148,8 @@ } else if (name == "combo") {
args["c"] = arg } else if (name == "honker") { args["xid"] = arg + } else if (name == "user") { + args["uname"] = arg } return args }
M
web.go
→
web.go
@@ -712,6 +712,8 @@ }
u := login.GetUserInfo(r) honks := gethonksbyuser(name, u != nil && u.Username == name, 0) templinfo := getInfo(r) + templinfo["PageName"] = "user" + templinfo["PageArg"] = name templinfo["Name"] = user.Name templinfo["WhatAbout"] = user.HTAbout templinfo["ServerMessage"] = ""@@ -2272,6 +2274,10 @@ <button tabindex=1 name="add honker" value="add honker">add honker</button>
</form>`, login.GetCSRF("submithonker", r), xid) msg := templates.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>%s`, xid, xid, miniform) hydra.Srvmsg = msg + case "user": + uname := r.FormValue("uname") + honks = gethonksbyuser(uname, u != nil && u.Username == uname, wanted) + hydra.Srvmsg = templates.Sprintf("honks by user: %s", uname) default: http.NotFound(w, r) }