From 1f7d760e41016aa9ab6a9cfa78aabc877c88962d Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Thu, 9 Feb 2023 23:30:07 -0700 Subject: [PATCH] fix title tag and tree .. link --- routes/routes.go | 3 ++- templates/file.html | 2 -- templates/head.html | 20 ++++++++++++++++++++ templates/index.html | 6 ------ templates/log.html | 5 ----- templates/refs.html | 4 ---- templates/repo.html | 5 ----- templates/tree.html | 5 ----- 8 files changed, 22 insertions(+), 28 deletions(-) diff --git a/routes/routes.go b/routes/routes.go index 3c82bdb..f1b1286 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -187,6 +187,7 @@ func (d *deps) RepoTree(w http.ResponseWriter, r *http.Request) { data["ref"] = ref data["parent"] = treePath data["desc"] = getDescription(path) + data["dotdot"] = filepath.Dir(treePath) d.listFiles(files, data, w) return @@ -249,7 +250,7 @@ func (d *deps) Log(w http.ResponseWriter, r *http.Request) { data["name"] = name data["ref"] = ref data["desc"] = getDescription(path) - data["dotdot"] = filepath.Dir(path) + data["log"] = true if err := d.t.ExecuteTemplate(w, "log", data); err != nil { log.Println(err) diff --git a/templates/file.html b/templates/file.html index 208f653..f015974 100644 --- a/templates/file.html +++ b/templates/file.html @@ -1,8 +1,6 @@ {{ define "file" }} {{ template "head" . }} - {{.name }} — {{ .path }} - {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/head.html b/templates/head.html index 53487eb..6fc1761 100644 --- a/templates/head.html +++ b/templates/head.html @@ -5,6 +5,26 @@ + {{ if .parent }} + {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/ + + {{ else if .path }} + {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }} + {{ else if .files }} + {{ .meta.Title }} — {{ .name }} ({{ .ref }}) + {{ else if .commit }} + {{ .meta.Title }} — {{ .name }}: {{ .commit.This }} + {{ else if .branches }} + {{ .meta.Title }} — {{ .name }}: refs + {{ else if .commits }} + {{ if .log }} + {{ .meta.Title }} — {{ .name }}: log + {{ else }} + {{ .meta.Title }} — {{ .name }} + {{ end }} + {{ else }} + {{ .meta.Title }} + {{ end }} {{ if and .servername .gomod }} {{ end }} diff --git a/templates/index.html b/templates/index.html index ae1109c..163d6a4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,12 +1,6 @@ {{ define "index" }} {{ template "head" . }} - - - {{ .meta.Title }} - - -

{{ .meta.Title }}

diff --git a/templates/log.html b/templates/log.html index 372518a..9c783aa 100644 --- a/templates/log.html +++ b/templates/log.html @@ -1,11 +1,6 @@ {{ define "log" }} {{ template "head" . }} - - - {{ .name }} — log - - {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/refs.html b/templates/refs.html index 541ef4c..a7f6a9c 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -2,10 +2,6 @@ {{ template "head" . }} - - {{ .name }} — refs - - {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/repo.html b/templates/repo.html index 99b718f..7401ca4 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -1,10 +1,5 @@ {{ define "repo" }} - {{ .name }} - {{ if .parent }} - — {{ .parent }} - {{ end }} - {{ template "head" . }} {{ template "repoheader" . }} diff --git a/templates/tree.html b/templates/tree.html index be285c0..c5fb38f 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -1,10 +1,5 @@ {{ define "tree" }} - {{ .name }} - {{ if .parent }} - — {{ .parent }} - {{ end }} - {{ template "head" . }} {{ template "repoheader" . }}