all repos — honk @ a615b9b14a5b5ab64cc9b478fda7acb970790974

my fork of honk

simplify loading templates
Ted Unangst tedu@tedunangst.com
Tue, 19 Dec 2023 15:28:40 -0500
commit

a615b9b14a5b5ab64cc9b478fda7acb970790974

parent

dccfd701f6e16544fe5ca0a967d29a89a4ac38a2

1 files changed, 10 insertions(+), 20 deletions(-)

jump to
M web.goweb.go

@@ -2791,26 +2791,16 @@ go qotd()

loadLingo() emuinit() - readviews = templates.Load(develMode, - viewDir+"/views/honkpage.html", - viewDir+"/views/honkfrags.html", - viewDir+"/views/honkers.html", - viewDir+"/views/chatter.html", - viewDir+"/views/hfcs.html", - viewDir+"/views/combos.html", - viewDir+"/views/honkform.html", - viewDir+"/views/honk.html", - viewDir+"/views/account.html", - viewDir+"/views/about.html", - viewDir+"/views/funzone.html", - viewDir+"/views/login.html", - viewDir+"/views/xzone.html", - viewDir+"/views/msg.html", - viewDir+"/views/header.html", - viewDir+"/views/onts.html", - viewDir+"/views/emus.html", - viewDir+"/views/honkpage.js", - ) + var toload []string + dents, _ := os.ReadDir(viewDir + "/views") + for _, dent := range dents { + name := dent.Name() + if strings.HasSuffix(name, ".html") { + toload = append(toload, viewDir+"/views/"+name) + } + } + + readviews = templates.Load(develMode, toload...) if !develMode { assets := []string{ viewDir + "/views/style.css",