display actual reaction for the button label
Ted Unangst tedu@tedunangst.com
Sun, 19 Apr 2020 20:10:40 -0400
3 files changed,
6 insertions(+),
2 deletions(-)
M
views/honk.html
→
views/honk.html
@@ -121,10 +121,12 @@ {{ else }}
<button onclick="return flogit(this, 'untag', '{{ .Honk.XID }}');">untag me</button> {{ end }} <button><a href="/edit?xid={{ .Honk.XID }}">edit</a></button> +{{ if not (eq .Badonk "none") }} {{ if .Honk.IsReacted }} <button disabled>badonked</button> {{ else }} -<button onclick="return flogit(this, 'react', '{{ .Honk.XID }}');">badonk</button> +<button onclick="return flogit(this, 'react', '{{ .Honk.XID }}');">{{ .Badonk }}</button> +{{ end }} {{ end }} </div> </details>
M
views/honkpage.html
→
views/honkpage.html
@@ -34,8 +34,9 @@ <div>
{{ $BonkCSRF := .HonkCSRF }} {{ $IsPreview := .IsPreview }} {{ $MapLink := .MapLink }} +{{ $Badonk := .User.Options.Reaction }} {{ range .Honks }} -{{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview }} +{{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview "Badonk" $Badonk }} {{ end }} </div> </div>
M
web.go
→
web.go
@@ -1092,6 +1092,7 @@ func honkpage(w http.ResponseWriter, u *login.UserInfo, honks []*Honk, templinfo map[string]interface{}) {
var userid int64 = -1 if u != nil { userid = u.UserID + templinfo["User"], _ = butwhatabout(u.Username) } reverbolate(userid, honks) templinfo["Honks"] = honks