From e4d12fc667c9830dd5f08f827b2a70adff58a09b Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Sun, 18 Dec 2022 10:42:18 +0530 Subject: [PATCH] templates: unified repo-header --- templates/commit.html | 7 +++---- templates/file.html | 25 +++++++++++++------------ templates/log.html | 5 +---- templates/refs.html | 27 +++++++++++++++++---------- templates/repo-header.html | 12 ++++++++++++ templates/repo.html | 9 ++------- templates/tree.html | 5 +---- 7 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 templates/repo-header.html diff --git a/templates/commit.html b/templates/commit.html index b4061aa..9ab945a 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -2,10 +2,7 @@ {{ template "head" . }} -
-

{{ .meta.Title }}

-

{{ .meta.Description }}

-
+ {{ template "repoheader" . }} {{ template "nav" . }}
@@ -19,9 +16,11 @@ {{ .commit.This }}

+ {{ if .commit.Parent }}

parent: {{ .commit.Parent }} + {{ end }}

diff --git a/templates/file.html b/templates/file.html index ed658e3..4d606cc 100644 --- a/templates/file.html +++ b/templates/file.html @@ -2,21 +2,22 @@ {{ template "head" . }} -
-

{{ .meta.Title }}

-

{{ .meta.Description }}

-
+ {{ template "repoheader" . }} {{ template "nav" . }}
-
-{{ range .linecount }}
-{{ . }}
-{{- end -}}
-    
-
-{{ .content }}
-      
+
+
+ {{- range .linecount }} +{{ . }} + {{- end -}} +
+
+ +
+            {{- .content -}}
+          
+
diff --git a/templates/log.html b/templates/log.html index 4a0292c..f5956be 100644 --- a/templates/log.html +++ b/templates/log.html @@ -2,10 +2,7 @@ {{ template "head" . }} -
-

{{ .meta.Title }}

-

{{ .meta.Description }}

-
+ {{ template "repoheader" . }} {{ template "nav" . }}
diff --git a/templates/refs.html b/templates/refs.html index aee4a11..5320a8e 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -2,32 +2,39 @@ {{ template "head" . }} -
-

{{ .meta.Title }}

-

{{ .meta.Description }}

-
+ {{ template "repoheader" . }} {{ template "nav" . }}
-

branches

{{ $name := .name }} +

branches

+
{{ range .branches }} -

- {{ .Name.Short }} - browse - log -

+
+ {{ .Name.Short }} +
+
+ browse + log +
{{ end }} +
{{ if .tags }}

tags

+
{{ range .tags }} +
{{ .Name }} +
+
browse log {{ if .Message }}
{{ .Message }}
+
{{ end }} {{ end }} +
{{ end }}
diff --git a/templates/repo-header.html b/templates/repo-header.html new file mode 100644 index 0000000..dd84875 --- /dev/null +++ b/templates/repo-header.html @@ -0,0 +1,12 @@ +{{ define "repoheader" }} +
+

+ all repos + — {{ .name }} + {{ if .ref }} + @ {{ .ref }} + {{ end }} +

+

{{ .desc }}

+
+{{ end }} diff --git a/templates/repo.html b/templates/repo.html index 3b5d2b0..2e87b07 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -7,13 +7,8 @@ {{ template "head" . }} -
-

- all repos - — {{ .name }} -

-

{{ .desc }}

-
+{{ template "repoheader" . }} + {{ template "nav" . }}
diff --git a/templates/tree.html b/templates/tree.html index b63a23e..2880714 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -7,10 +7,7 @@ {{ template "head" . }} -
-

{{ .meta.Title }}

-

{{ .meta.Description }}

-
+ {{ template "repoheader" . }} {{ template "nav" . }}