all repos — legit @ 22cf7a4a8974bed2d494823c63c4a6a7ee77e2c2

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></div>
22        <div><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></div>
23        {{ end }}
24        {{ range .files }}
25        {{ if not .IsFile }}
26        <div class="mode">{{ .Mode }}</div>
27        <div class="size">{{ .Size }}</div>
28        <div>
29          {{ if $parent }}
30          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
31          {{ else }}
32          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
33          {{ end }}
34        </div>
35        {{ end }}
36        {{ end }}
37        {{ range .files }}
38        {{ if .IsFile }}
39        <div class="mode">{{ .Mode }}</div>
40        <div class="size">{{ .Size }}</div>
41        <div>
42          {{ if $parent }}
43          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
44          {{ else }}
45          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
46          {{ end }}
47        </div>
48        {{ end }}
49        {{ end }}
50      </div>
51      <article>
52        <pre>
53          {{- if .readme }}{{ .readme }}{{- end -}}
54        </pre>
55      </article>
56    </main>
57  </body>
58</html>
59{{ end }}