mugit/web/templates/repo_tree.html (view raw)
Oleksandr Smirnov
Oleksandr Smirnov
olexsmir@gmail.com ui: remove `log` from refs & always show readme on tree view, 21 days ago
olexsmir@gmail.com ui: remove `log` from refs & always show readme on tree view, 21 days 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 | {{ if .P.Breadcrumbs }} |
| 14 | <p class="mb"> |
| 15 | <a class="link" href="/{{ $name }}/tree/{{ .P.Ref }}">{{ .RepoName }}</a> |
| 16 | {{- range .P.Breadcrumbs -}} |
| 17 | <span class="mono">/</span> |
| 18 | {{- if .IsLast -}}{{- .Name -}} |
| 19 | {{- else -}}<a class="link" href="/{{ $name }}/tree/{{ $.P.Ref }}/{{ .Path }}">{{ .Name }}</a>{{- end -}} |
| 20 | {{- end -}} |
| 21 | </p> |
| 22 | {{ end }} |
| 23 | <table class="table tree"> |
| 24 | <thead> |
| 25 | <tr class="nohover"> |
| 26 | <th class="nowrap">name</th> |
| 27 | <th class="fill last-commit">last commit</th> |
| 28 | <th class="nowrap">last update</th> |
| 29 | </tr> |
| 30 | </thead> |
| 31 | <tbody> |
| 32 | {{ if $parent }} |
| 33 | <tr> |
| 34 | <td class="nowrap"><a href="/{{ $name }}/tree/{{ urlencode $ref }}/{{ .P.DotDot }}">..</a></td> |
| 35 | <th class="fill"></th> |
| 36 | <th class="nowrap"></th> |
| 37 | </tr> |
| 38 | {{ end }} |
| 39 | |
| 40 | {{ range .P.Tree }} |
| 41 | {{ if not .IsFile }} |
| 42 | <tr> |
| 43 | <td class="nowrap"> |
| 44 | {{ if $parent }}<a href="/{{ $name}}/tree/{{ urlencode $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a> |
| 45 | {{ else }}<a href="/{{ $name }}/tree/{{ urlencode $ref }}/{{ .Name }}">{{ .Name }}/</a>{{ end }} |
| 46 | </td> |
| 47 | <td class="fill last-commit"> |
| 48 | <a class="muted" href="/{{ $name }}/commit/{{ .Commit.Hash }}">{{ commitSummary .Commit.Message }}</a> |
| 49 | </td> |
| 50 | <td class="has-tip nowrap"> |
| 51 | <a href="/{{ $.RepoName }}/commit/{{ .Commit.Hash }}">{{ humanizeRelTime .Commit.Committed }}</a> |
| 52 | <span class="tooltip" role="tooltip">{{ humanizeTime .Commit.Committed }}</span> |
| 53 | </td> |
| 54 | </tr> |
| 55 | {{ end }} |
| 56 | {{ end }} |
| 57 | |
| 58 | {{ range .P.Tree }} |
| 59 | {{ if .IsFile }} |
| 60 | <tr> |
| 61 | <td class="nowrap"> |
| 62 | {{ if $parent }}<a href="/{{ $name }}/blob/{{ urlencode $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a> |
| 63 | {{ else }}<a href="/{{ $name }}/blob/{{ urlencode $ref }}/{{ .Name }}">{{ .Name }}</a>{{ end }} |
| 64 | </td> |
| 65 | <td class="fill last-commit"> |
| 66 | <a class="muted" href="/{{ $.RepoName }}/commit/{{ .Commit.Hash }}">{{ commitSummary .Commit.Message }}</a> |
| 67 | </td> |
| 68 | <td class="has-tip nowrap"> |
| 69 | <a href="/{{ $.RepoName }}/commit/{{ .Commit.Hash }}">{{ humanizeRelTime .Commit.Committed }}</a> |
| 70 | <span class="tooltip" role="tooltip">{{ humanizeTime .Commit.Committed }}</span> |
| 71 | </td> |
| 72 | </tr> |
| 73 | {{ end }} |
| 74 | {{ end }} |
| 75 | </tbody> |
| 76 | </table> |
| 77 | |
| 78 | {{ if .P.Readme }}<article class="readme">{{.P.Readme}}</article>{{ end }} |
| 79 | </main> |
| 80 | </body> |
| 81 | </html> |
| 82 | {{ end }} |