all repos — honk @ 5d8298cf3ac70bf4a47e7be4882c5c997dad25d8

my fork of honk

jump links for honkers list
Ted Unangst tedu@tedunangst.com
Sat, 02 Mar 2024 20:17:11 -0500
commit

5d8298cf3ac70bf4a47e7be4882c5c997dad25d8

parent

009d3a2f27c6734ede0429a60e2814710e3f4a64

2 files changed, 22 insertions(+), 2 deletions(-)

jump to
M views/honkers.htmlviews/honkers.html

@@ -23,8 +23,15 @@ </div>

{{ $honkercsrf := .HonkerCSRF }} <div class="info"> <p><button class="expand">expand</button> +<p>{{ range .Letters }}<a href="#{{.}}">{{.}}</a> {{ end }} </div> +{{ $firstrune := .FirstRune }} +{{ $letter := 0 }} {{ range .Honkers }} +{{ if not (eq $letter (call $firstrune .Name)) }} +{{ $letter = (call $firstrune .Name) }} +<a name="{{ printf "%c" $letter}}"></a> +{{ end }} <section class="honk"> <header> <img alt="avatar" src="/a?a={{ .XID }}">
M web.goweb.go

@@ -995,7 +995,7 @@ }

templinfo := getInfo(r) templinfo["Pops"] = pops templinfo["Onts"] = onts - templinfo["FirstRune"] = func(s string) rune { r, _ := utf8.DecodeRuneInString(s); return r } + templinfo["FirstRune"] = firstRune err = readviews.Execute(w, "onts.html", templinfo) if err != nil { elog.Print(err)

@@ -2084,10 +2084,23 @@

return honk } +func firstRune(s string) rune { r, _ := utf8.DecodeRuneInString(s); return r } + func showhonkers(w http.ResponseWriter, r *http.Request) { userid := UserID(login.GetUserInfo(r).UserID) + honkers := gethonkers(userid) + var letters []string + var lastrune rune = -1 + for _, h := range honkers { + if r := firstRune(h.Name); r != lastrune { + letters = append(letters, string(r)) + lastrune = r + } + } templinfo := getInfo(r) - templinfo["Honkers"] = gethonkers(userid) + templinfo["FirstRune"] = firstRune + templinfo["Letters"] = letters + templinfo["Honkers"] = honkers templinfo["HonkerCSRF"] = login.GetCSRF("submithonker", r) err := readviews.Execute(w, "honkers.html", templinfo) if err != nil {