summaryrefslogtreecommitdiffstats
path: root/templates/repo.html
blob: ddc3f0130410fb0c32b50d4e7e098b6714673bd3 (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
{{ define "repo" }}
<html>
{{ template "head" . }}

  <header>
    <h1>{{ .meta.Title }}</h1>
    <h2>{{ .meta.Description }}</h2>
  </header>
  <body>
    {{ template "nav" . }}
    <main>
      {{ $repo := .name }}
      {{ $ref := .ref }}
      {{ $parent := .parent }}

      <table>
        <tr>
          <td></td>
          <td><a href="../">..</a>
        </tr>
      {{ range .files }}
        {{ if .IsFile }}
        <tr>
          <td><code>{{ .Mode }}</code></td>
          <td>
          {{ if $parent }}
          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
          {{ else }}
          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
          {{ end }}
          </td>
        </tr>
        {{ else }}
        <tr>
          <td><code>{{ .Mode }}</code></td>
          <td>
          {{ if $parent }}
          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
          {{ else }}
          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
          {{ end }}
          </td>
        </tr>
        {{ end }}
      {{ end }}
      </table>
      <article>
        <pre>
          {{- if .readme }}{{ .readme }}{{- end -}}
        </pre>
      </article>
    </main>
  </body>
</html>
{{ end }}