all repos — legit @ 5091695e75b2db30b8926d8aa17164c84031bc77

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  <header>
11    <h1>{{ .meta.Title }}</h1>
12    <h2>{{ .meta.Description }}</h2>
13  </header>
14  <body>
15    {{ template "nav" . }}
16    <main>
17      {{ $repo := .name }}
18      {{ $ref := .ref }}
19      {{ $parent := .parent }}
20
21      <div class="tree">
22        {{ if $parent }}
23        <div></div>
24        <div><a href="../">..</a></div>
25        {{ end }}
26        {{ range .files }}
27        <div class="mode">{{ .Mode }}</div>
28        <div>
29        {{ if .IsFile }}
30          {{ if $parent }}
31          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
32          {{ else }}
33          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
34          {{ end }}
35        {{ else }}
36          {{ if $parent }}
37          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
38          {{ else }}
39          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
40          {{ end }}
41        {{ end }}
42        </div>
43        {{ end }}
44      </div>
45      <article>
46        <pre>
47          {{- if .readme }}{{ .readme }}{{- end -}}
48        </pre>
49      </article>
50    </main>
51  </body>
52</html>
53{{ end }}