all repos

mugit @ be1cdfdd76f4248e14a065d5b2c6710a5f79b2fe

🐮 git server that your cow will love

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

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ui: show last commit for file that's being viewed, 29 days 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
22
      <div class="box msb">
23
        <span class="has-tip">
24
          <span>
25
           <a class="bold" href="mailto:{{ .P.LastCommit.AuthorEmail }}">{{ .P.LastCommit.AuthorName }}</a>
26
          </span>
27
          <span class="tooltip" role="tooltip">
28
            <strong>{{ .P.LastCommit.AuthorName }}</strong><br>
29
            <a href="mailto:{{ .P.LastCommit.AuthorEmail }}" class="commit-email">{{ .P.LastCommit.AuthorEmail }}</a>
30
          </span>
31
        </span>
32
        <span class="pl">
33
          <a class="link" href="/{{ .RepoName }}/commit/{{ .P.LastCommit.Hash }}">
34
            {{- if .P.LastCommit.Message }}{{- commitSummary .P.LastCommit.Message -}}
35
            {{- else -}}<span class="muted">Empty message</span>{{- end -}}
36
          </a>,
37
        </span>
38
        <span class="muted">{{ humanizeRelTime .P.LastCommit.Committed }}</span>
39
      </div>
40
41
      <div class="file-wrapper">
42
        {{ if .P.IsImage }}
43
        <div class="image-viewer">
44
          <p>{{ .P.Mime }} • {{ .P.Size }} bytes</p>
45
          <img src="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}" alt="{{- .P.Path -}}">
46
        </div>
47
        {{ else if .P.IsBinary }}
48
        <div class="binary-viewer">
49
          <p>Binary file ({{ .P.Mime }})</p>
50
          <p>Size: {{ .P.Size }} bytes</p>
51
          <a class="link" href="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}" download>[ Download ]</a>
52
        </div>
53
        {{ else }}
54
        <table class="file-contents" tabindex="-1">
55
          <tbody>
56
            {{- range $i, $l := .P.Lines }}
57
            <tr class="line">
58
              <td class="line-number mono">
59
                <a id="L{{ inc $i }}" href="#L{{ inc $i }}" aria>{{ inc $i }}</a>
60
              </td>
61
              <td><pre>{{ $l }}</pre></td>
62
            </tr>
63
            {{- end -}}
64
          </tbody>
65
        </table>
66
        {{ end }}
67
      </div>
68
    </main>
69
  </body>
70
</html>
71
{{ end }}