all repos

mugit @ 48f24d9

🐮 git server that your cow will love

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

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ui: show remote urls on empty repo page, 2 months ago
1
{{ define "_remote_urls" }}
2
<h2>Clone urls</h2>
3
<pre>https://{{.Meta.Host}}/{{.RepoName}}</pre>
4
{{ if .Meta.SSHEnabled }}<pre>{{.P.SSHUser}}@{{.Meta.Host}}:{{.RepoName}}</pre>{{ end }}
5
{{ end }}
6
7
{{ define "repo_index" }}
8
<!DOCTYPE html>
9
<html>
10
  <head>
11
    {{ template "head" . }}
12
    <title>{{ .RepoName}} &mdash; {{ .Meta.Title }}</title>
13
  </head>
14
  <body>
15
    {{ template "repo_header" . }}
16
    <main>
17
      {{ if .P.IsEmpty }}
18
      <h3>Repository is empty</h3>
19
      {{ if .P.IsMirror }}
20
      <p>
21
        Awaiting initial sync from:
22
        <a class="link" href="{{.P.MirrorURL}}" target="_blank">{{.P.MirrorURL}}</a>
23
      </p>
24
      <br>
25
      {{ template "_remote_urls" . }}
26
      {{ end }}
27
      {{ else }}
28
      <section class="repo-index">
29
        <div class="repo-index-main">
30
          {{ $repo := .RepoName }}
31
          {{ range .P.Commits }}
32
          <div class="box">
33
            <div>
34
              <a href="/{{ $repo }}/commit/{{ .Hash }}" class="commit-hash link">{{ .HashShort }}</a>
35
              &mdash; {{ .AuthorName }}
36
              <span class="commit-date commit-info has-tip">
37
                {{ .Committed.Format "Mon, 02 Jan 2006" }}
38
                <span class="tooltip" role="tooltip">{{ humanizeTime .Committed }}</span>
39
              </span>
40
            </div>
41
            <div>
42
              {{- if .Message }}{{- commitSummary .Message -}}
43
              {{- else -}}<span class="muted">Empty message</span>{{- end -}}
44
            </div>
45
          </div>
46
          {{ end }}
47
        </div>
48
49
        <div class="repo-index-side">
50
          {{ template "_remote_urls" . }}
51
          {{ if .P.IsMirror }}
52
          <br>
53
          <h2>Mirror status</h2>
54
          <p>
55
            {{ if .P.MirrorLastSync.IsZero }}Was not yet synced from:
56
            {{ else }}Last updated {{ humanizeRelTime .P.MirrorLastSync }} from:
57
            {{ end }}
58
            <a href="{{.P.MirrorURL}}" target="_blank">{{.P.MirrorURL}}</a>
59
          </p>
60
          {{ end }}
61
        </div>
62
      </section>
63
64
      {{ if .P.Readme }}<article class="readme">{{.P.Readme}}</article>{{ end }}
65
      {{ end }}
66
    </main>
67
  </body>
68
</html>
69
{{ end }}