all repos — legit @ 089ada4cac4dd900646c2039960214f549bed058

web frontend for git, written in go

templates/tree.html (view raw)

 1{{ define "tree" }}
 2<html>
 3  <title>{{ .name }}
 4    {{ if .parent }}
 5    &mdash; {{ .parent }}
 6    {{ end }}
 7  </title>
 8{{ template "head" . }}
 9
10  {{ template "repoheader" . }}
11  <body>
12    {{ template "nav" . }}
13    <main>
14      {{ $repo := .name }}
15      {{ $ref := .ref }}
16      {{ $parent := .parent }}
17
18      <div class="tree">
19        {{ if $parent }}
20        <div></div>
21        <div><a href="../">..</a></div>
22        {{ end }}
23        {{ range .files }}
24        <div class="mode">{{ .Mode }}</div>
25        <div>
26        {{ if .IsFile }}
27          {{ if $parent }}
28          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
29          {{ else }}
30          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
31          {{ end }}
32        {{ else }}
33          {{ if $parent }}
34          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
35          {{ else }}
36          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
37          {{ end }}
38        {{ end }}
39        </div>
40        {{ end }}
41      </div>
42      <article>
43        <pre>
44          {{- if .readme }}{{ .readme }}{{- end -}}
45        </pre>
46      </article>
47    </main>
48  </body>
49</html>
50{{ end }}