all repos — elgit @ 856f66808b913baff13c815daec3cdde7121e3bd

fork of legit: web frontend for git, written in go

all: init

commit

856f66808b913baff13c815daec3cdde7121e3bd

1 file changed, 32 insertions(+), 0 deletions(-)

changed files
A routes/template.go
@@ -0,0 +1,32 @@
+package routes + +import ( + "html/template" + "net/http" + "os" + "path/filepath" + + "icyphox.sh/legit/config" +) + +func Write404(w http.ResponseWriter, c config.Config) { + w.WriteHeader(404) + tpath := filepath.Join(c.Template.Dir, "404.html") + t := template.Must(template.ParseFiles(tpath)) + t.Execute(w, nil) +} + +func Write500(w http.ResponseWriter, c config.Config) { + w.WriteHeader(500) + tpath := filepath.Join(c.Template.Dir, "500.html") + t := template.Must(template.ParseFiles(tpath)) + t.Execute(w, nil) +} + +func funcMap() template.FuncMap { + return template.FuncMap{ + "prettyMode": func(mode uint32) string { + return os.FileMode(mode).String() + }, + } +}