summaryrefslogtreecommitdiffstats
path: root/templates/tree.html
diff options
context:
space:
mode:
authorLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-17 21:33:04 +0530
committerLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-17 21:33:04 +0530
commit5091695e75b2db30b8926d8aa17164c84031bc77 (patch)
tree40cd73e213e935634229fdadb701badd939846fd /templates/tree.html
parent4eaaf451295ce9b541769d1322543f2d982ef5b0 (diff)
downloadlegit-5091695e75b2db30b8926d8aa17164c84031bc77.tar.gz
legit-5091695e75b2db30b8926d8aa17164c84031bc77.tar.bz2
legit-5091695e75b2db30b8926d8aa17164c84031bc77.zip
templates: repo and log
Diffstat (limited to '')
-rw-r--r--templates/tree.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/templates/tree.html b/templates/tree.html
new file mode 100644
index 0000000..b63a23e
--- /dev/null
+++ b/templates/tree.html
@@ -0,0 +1,53 @@
+{{ define "tree" }}
+<html>
+ <title>{{ .name }}
+ {{ if .parent }}
+ &mdash; {{ .parent }}
+ {{ end }}
+ </title>
+{{ template "head" . }}
+
+ <header>
+ <h1>{{ .meta.Title }}</h1>
+ <h2>{{ .meta.Description }}</h2>
+ </header>
+ <body>
+ {{ template "nav" . }}
+ <main>
+ {{ $repo := .name }}
+ {{ $ref := .ref }}
+ {{ $parent := .parent }}
+
+ <div class="tree">
+ {{ if $parent }}
+ <div></div>
+ <div><a href="../">..</a></div>
+ {{ end }}
+ {{ range .files }}
+ <div class="mode">{{ .Mode }}</div>
+ <div>
+ {{ if .IsFile }}
+ {{ if $parent }}
+ <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
+ {{ else }}
+ <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
+ {{ end }}
+ {{ else }}
+ {{ if $parent }}
+ <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
+ {{ else }}
+ <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
+ {{ end }}
+ {{ end }}
+ </div>
+ {{ end }}
+ </div>
+ <article>
+ <pre>
+ {{- if .readme }}{{ .readme }}{{- end -}}
+ </pre>
+ </article>
+ </main>
+ </body>
+</html>
+{{ end }}