all repos

mugit @ 4ca522b0d1f6c250a3d3387216b3515eb33ad7ee

🐮 git server that your cow will love

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

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ui: dont render readme for / in tree view, 3 months ago
1
{{ define "repo_tree" }}
2
{{ $name := .RepoName }}
3
{{ $ref := .P.Ref }}
4
<html>
5
  <head>
6
    {{ template "head" . }}
7
    <title>{{ $name }}: tree ({{ $ref }})</title>
8
  </head>
9
  <body>
10
    {{ template "repo_header" . }}
11
    <main>
12
      {{ $parent := .P.ParentPath }}
13
14
      <table class="table tree">
15
        <thead>
16
          <tr class="nohover">
17
            <th class="nowrap">name</th>
18
            <th class="fill">last commit</th>
19
            <th class="nowrap">last update</th>
20
          </tr>
21
        </thead>
22
        <tbody>
23
          {{ if $parent }}
24
          <tr>
25
            <td class="nowrap"><a href="/{{ $name }}/tree/{{ urlencode $ref }}/{{ .P.DotDot }}">..</a></td>
26
            <th class="fill"></th>
27
            <th class="nowrap"></th>
28
          </tr>
29
          {{ end }}
30
31
          {{ range .P.Tree }}
32
          {{ if not .IsFile }}
33
          <tr>
34
            <td class="nowrap">
35
              {{ if $parent }}<a href="/{{ $name}}/tree/{{ urlencode $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
36
              {{ else }}<a href="/{{ $name }}/tree/{{ urlencode $ref }}/{{ .Name }}">{{ .Name }}/</a>{{ end }}
37
            </td>
38
            <td class="fill">
39
              <a href="/{{ $name }}/commit/{{ .Commit.Hash }}">{{ commitSummary .Commit.Message }}</a>
40
            </td>
41
            <td class="age nowrap">
42
              <a href="/{{ $.RepoName }}/commit/{{ .Commit.Hash }}">{{ humanizeRelTime .Commit.Committed }}</a>
43
              <span class="tooltip" role="tooltip">{{ humanizeTime .Commit.Committed }}</span>
44
            </td>
45
          </tr>
46
          {{ end }}
47
          {{ end }}
48
49
          {{ range .P.Tree }}
50
          {{ if .IsFile }}
51
          <tr>
52
            <td class="nowrap">
53
              {{ if $parent }}<a href="/{{ $name }}/blob/{{ urlencode $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
54
              {{ else }}<a href="/{{ $name }}/blob/{{ urlencode $ref }}/{{ .Name }}">{{ .Name }}</a>{{ end }}
55
            </td>
56
            <td class="fill">
57
              <a href="/{{ $.RepoName }}/commit/{{ .Commit.Hash }}">{{ commitSummary .Commit.Message }}</a>
58
            </td>
59
            <td class="age nowrap">
60
              <a href="/{{ $.RepoName }}/commit/{{ .Commit.Hash }}">{{ humanizeRelTime .Commit.Committed }}</a>
61
              <span class="tooltip" role="tooltip">{{ humanizeTime .Commit.Committed }}</span>
62
            </td>
63
          </tr>
64
          {{ end }}
65
          {{ end }}
66
        </tbody>
67
      </table>
68
69
      {{- if and .P.Readme .P.ParentPath -}}
70
      <article class="readme">{{- .P.Readme -}}</article>
71
      {{- end -}}
72
    </main>
73
  </body>
74
</html>
75
{{ end }}