all repos

mugit @ 6bb47d3

🐮 git server that your cow will love

mugit/web/templates/repo_file.html (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ui: add padding between filepath breadcrumbs and "view raw" link, 2 months ago
1
{{ define "repo_file" }}
2
<html>
3
  <head>
4
    {{ template "head" . }}
5
    <title>{{ .RepoName }}: {{ .P.Path }} ({{ .P.Ref }})</title>
6
  </head>
7
  <body>
8
    {{ template "repo_header" . }}
9
    <main>
10
      <p>
11
        <a class="link" href="/{{ .RepoName }}/tree/{{ .P.Ref }}">{{ .RepoName }}</a>
12
        {{- range .P.Breadcrumbs  -}}
13
        <span class="mono">/</span>
14
        {{- if .IsLast -}}{{- .Name -}}
15
        {{- else -}}<a class="link" href="/{{ $.RepoName }}/tree/{{ $.P.Ref }}/{{ .Path }}">{{ .Name }}</a>{{- end -}}
16
        {{- end -}}
17
        <span class="pl">
18
          (<a class="muted" href="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}">view raw</a>)
19
        </span>
20
      </p>
21
      <div class="file-wrapper">
22
        {{ if .P.IsImage }}
23
        <div class="image-viewer">
24
          <p>{{ .P.Mime }} • {{ .P.Size }} bytes</p>
25
          <img src="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}" alt="{{- .P.Path -}}">
26
        </div>
27
        {{ else if .P.IsBinary }}
28
        <div class="binary-viewer">
29
          <p>Binary file ({{ .P.Mime }})</p>
30
          <p>Size: {{ .P.Size }} bytes</p>
31
          <a class="link" href="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}" download>[ Download ]</a>
32
        </div>
33
        {{ else }}
34
        <table class="file-contents" tabindex="-1">
35
          <tbody>
36
            {{- range $i, $l := .P.Lines }}
37
            <tr class="line">
38
              <td class="line-number mono">
39
                <a id="L{{ inc $i }}" href="#L{{ inc $i }}" aria>{{ inc $i }}</a>
40
              </td>
41
              <td><pre>{{ $l }}</pre></td>
42
            </tr>
43
            {{- end -}}
44
          </tbody>
45
        </table>
46
        {{ end }}
47
      </div>
48
    </main>
49
  </body>
50
</html>
51
{{ end }}