summaryrefslogtreecommitdiffstats
path: root/routes/template.go
diff options
context:
space:
mode:
authorLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-17 12:45:21 +0530
committerLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-17 12:45:21 +0530
commitd083d5d72e4bf496b8152d14986818a5b63fe301 (patch)
treeae5dbe4a26ca13a66e02f1c67229548913433c27 /routes/template.go
parentb833d2f73d5f4e56d7e082495c44d394d2361cbd (diff)
downloadlegit-d083d5d72e4bf496b8152d14986818a5b63fe301.tar.gz
legit-d083d5d72e4bf496b8152d14986818a5b63fe301.tar.bz2
legit-d083d5d72e4bf496b8152d14986818a5b63fe301.zip
routes: serve static content from /static
Diffstat (limited to '')
-rw-r--r--routes/template.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routes/template.go b/routes/template.go
index 3d1e1cf..dc1ec35 100644
--- a/routes/template.go
+++ b/routes/template.go
@@ -13,7 +13,7 @@ import (
)
func (d *deps) Write404(w http.ResponseWriter) {
- tpath := filepath.Join(d.c.Template.Dir, "*")
+ tpath := filepath.Join(d.c.Dirs.Templates, "*")
t := template.Must(template.ParseGlob(tpath))
w.WriteHeader(404)
if err := t.ExecuteTemplate(w, "404", nil); err != nil {
@@ -22,7 +22,7 @@ func (d *deps) Write404(w http.ResponseWriter) {
}
func (d *deps) Write500(w http.ResponseWriter) {
- tpath := filepath.Join(d.c.Template.Dir, "*")
+ tpath := filepath.Join(d.c.Dirs.Templates, "*")
t := template.Must(template.ParseGlob(tpath))
w.WriteHeader(500)
if err := t.ExecuteTemplate(w, "500", nil); err != nil {
@@ -31,7 +31,7 @@ func (d *deps) Write500(w http.ResponseWriter) {
}
func (d *deps) listFiles(files []git.NiceTree, data map[string]any, w http.ResponseWriter) {
- tpath := filepath.Join(d.c.Template.Dir, "*")
+ tpath := filepath.Join(d.c.Dirs.Templates, "*")
t := template.Must(template.ParseGlob(tpath))
data["files"] = files
@@ -62,7 +62,7 @@ func countLines(r io.Reader) (int, error) {
}
func (d *deps) showFile(content string, data map[string]any, w http.ResponseWriter) {
- tpath := filepath.Join(d.c.Template.Dir, "*")
+ tpath := filepath.Join(d.c.Dirs.Templates, "*")
t := template.Must(template.ParseGlob(tpath))
lc, err := countLines(strings.NewReader(content))