all repos

mugit @ cc59ce4becd876f686c626f299c8969541c1d90f

🐮 git server that your cow will love

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

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ui: refactor how data is passed to pages, 3 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>{{ .P.Path }} (<a class="muted" href="?raw=true">view raw</a>)</p>
11
      <div class="file-wrapper">
12
        {{ if .P.IsImage }}
13
        <div class="image-viewer">
14
          <p>{{ .P.Mime }} • {{ .P.Size }} bytes</p>
15
          <img src="?raw=true" alt="{{- .P.Path -}}">
16
        </div>
17
        {{ else if .P.IsBinary }}
18
        <div class="binary-viewer">
19
          <p>Binary file ({{ .P.Mime }})</p>
20
          <p>Size: {{ .P.Size }} bytes</p>
21
          <a class="link" href="?raw=true" download>[ Download ]</a>
22
        </div>
23
        {{ else }}
24
        <table>
25
          <tbody>
26
            <tr>
27
              <td class="line-numbers">
28
<pre>{{- range .P.LineCount }}
29
<a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a>
30
{{- end -}}</pre>
31
              </td>
32
              <td class="file-content">
33
                <pre>{{- .P.Content -}}</pre>
34
              </td>
35
            </tr>
36
          </tbody>
37
        </table>
38
        {{ end }}
39
      </div>
40
    </main>
41
  </body>
42
</html>
43
{{ end }}