all repos — legit @ d1774f5a6d25242d659b1a08656de9e20fa84e26

web frontend for git

templates/tree.html (view raw)

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