add combos list to menu

This commit is contained in:
Ted Unangst 2019-09-24 13:52:06 -04:00
parent cf9804dfa0
commit 71ac199935
3 changed files with 14 additions and 5 deletions

View File

@ -22,7 +22,12 @@
<ul> <ul>
<li><a href="/{{ .UserSep }}/{{ .UserInfo.Username }}">{{ .UserInfo.Username }}</a> <li><a href="/{{ .UserSep }}/{{ .UserInfo.Username }}">{{ .UserInfo.Username }}</a>
<li><a href="/honkers">honkers</a> <li><a href="/honkers">honkers</a>
<li><a href="/c">combos</a> <li>combos
<ul>
{{ range .Combos }}
<li><a href="/c/{{ . }}">{{ . }}</a>
{{ end }}
</ul>
<li><a href="/o">tags</a> <li><a href="/o">tags</a>
<li><a href="/about">about</a> <li><a href="/about">about</a>
<li><a href="/front">front</a> <li><a href="/front">front</a>

View File

@ -51,18 +51,18 @@ body > header p {
body > header span { body > header span {
margin-left: 2em; margin-left: 2em;
} }
header details { header > details {
background: $bg-page; background: $bg-page;
padding: 1em; padding: 1em;
position: fixed; position: fixed;
top: 0; top: 0;
display: inline; display: inline;
} }
header details[open] { header > details[open] {
background: $bg-dark; background: $bg-dark;
border: 1px solid $fg; border: 1px solid $fg;
} }
header details li { header > details li {
margin: 1em 0em 1em 0em; margin: 1em 0em 1em 0em;
} }
main { main {

6
web.go
View File

@ -70,6 +70,11 @@ func getInfo(r *http.Request) map[string]interface{} {
templinfo["IconName"] = iconName templinfo["IconName"] = iconName
templinfo["UserInfo"] = u templinfo["UserInfo"] = u
templinfo["UserSep"] = userSep templinfo["UserSep"] = userSep
if u != nil {
var combos []string
combocache.Get(u.UserID, &combos)
templinfo["Combos"] = combos
}
return templinfo return templinfo
} }
@ -1101,7 +1106,6 @@ func showcombos(w http.ResponseWriter, r *http.Request) {
var combos []string var combos []string
combocache.Get(userinfo.UserID, &combos) combocache.Get(userinfo.UserID, &combos)
templinfo := getInfo(r) templinfo := getInfo(r)
templinfo["Combos"] = combos
err := readviews.Execute(w, "combos.html", templinfo) err := readviews.Execute(w, "combos.html", templinfo)
if err != nil { if err != nil {
log.Print(err) log.Print(err)