aboutsummaryrefslogtreecommitdiff
path: root/templates/tree.html
blob: 939767ab7475046ccbb937a34bc38ea084d08383 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{{ define "tree" }}
<!DOCTYPE html>
<html>
	<head>
		{{ template "generichead" . }}
		{{ if .parent }}
			<title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): {{ .parent }}/</title>
		{{ else if .files }}
			<title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }})</title>
		{{ else }}
			<title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): BROKEN???</title>
		{{ end }}
	</head>
	<body>
		{{ template "repoheader" . }}
		{{ template "nav" . }}
		<main>
			{{ $repo := .name }}
			{{ $ref := .ref }}
			{{ $parent := .parent }}
			<div class="tree">
				{{ if $parent }}
					<div><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></div>
				{{ end }}
				{{ range .files }}
					{{ if not .IsFile }}
						<div class="mode">{{ .Mode }}</div>
						<div class="size">{{ .Size }}</div>
						<div>
							{{ if $parent }}
								<a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
							{{ else }}
								<a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
							{{ end }}
						</div>
					{{ end }}
				{{ end }}
				{{ range .files }}
					{{ if .IsFile }}
						<div class="mode">{{ .Mode }}</div>
						<div class="size">{{ .Size }}</div>
						<div>
							{{ if $parent }}
								<a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
							{{ else }}
								<a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
							{{ end }}
						</div>
					{{ end }}
				{{ end }}
			</div>
			<article>
				<pre>{{- if .readme }}{{ .readme }}{{- end -}}</pre>
			</article>
		</main>
	</body>
</html>
{{ end }}