From 36b3f6e1e1f7e3c7b18d888cb1b5678c276b70ed Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 30 Apr 2019 18:48:13 -0400 Subject: [PATCH] quick add a list of all combos --- honk.go | 19 +++++++++++++++++++ views/combos.html | 14 ++++++++++++++ views/header.html | 1 + 3 files changed, 34 insertions(+) create mode 100644 views/combos.html diff --git a/honk.go b/honk.go index bd62e91..1237eaa 100644 --- a/honk.go +++ b/honk.go @@ -975,6 +975,23 @@ func showhonkers(w http.ResponseWriter, r *http.Request) { } } +func showcombos(w http.ResponseWriter, r *http.Request) { + userinfo := login.GetUserInfo(r) + templinfo := getInfo(r) + honkers := gethonkers(userinfo.UserID) + var combos []string + for _, h := range honkers { + combos = append(combos, h.Combos...) + } + combos = oneofakind(combos) + sort.Strings(combos) + templinfo["Combos"] = combos + err := readviews.Execute(w, "combos.html", templinfo) + if err != nil { + log.Print(err) + } +} + var handfull = make(map[string]string) var handlock sync.Mutex @@ -1210,6 +1227,7 @@ func serve() { "views/honkpage.html", "views/honkers.html", "views/zonkers.html", + "views/combos.html", "views/honkform.html", "views/honk.html", "views/login.html", @@ -1263,6 +1281,7 @@ func serve() { loggedin.HandleFunc("/honkers", showhonkers) loggedin.HandleFunc("/h/{name:[[:alnum:]]+}", showhonker) loggedin.HandleFunc("/c/{name:[[:alnum:]]+}", showcombo) + loggedin.HandleFunc("/c", showcombos) loggedin.Handle("/savehonker", login.CSRFWrap("savehonker", http.HandlerFunc(savehonker))) err = http.Serve(listener, mux) diff --git a/views/combos.html b/views/combos.html new file mode 100644 index 0000000..3bf4003 --- /dev/null +++ b/views/combos.html @@ -0,0 +1,14 @@ +{{ template "header.html" . }} +
+
+

combos +

+{{ range .Combos }} +
+
+

{{ . }} +

+

honks: {{ . }} +

+{{ end }} +
diff --git a/views/header.html b/views/header.html index f31e0df..a6e8f9c 100644 --- a/views/header.html +++ b/views/header.html @@ -16,6 +16,7 @@ @me {{ .UserInfo.Username }} honkers +combos killzone logout {{ else }}