mugit/web/templates/repo_file.html (view raw)
| 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 | (<a class="muted" href="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}">view raw</a>) |
| 18 | </p> |
| 19 | <div class="file-wrapper"> |
| 20 | {{ if .P.IsImage }} |
| 21 | <div class="image-viewer"> |
| 22 | <p>{{ .P.Mime }} • {{ .P.Size }} bytes</p> |
| 23 | <img src="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}" alt="{{- .P.Path -}}"> |
| 24 | </div> |
| 25 | {{ else if .P.IsBinary }} |
| 26 | <div class="binary-viewer"> |
| 27 | <p>Binary file ({{ .P.Mime }})</p> |
| 28 | <p>Size: {{ .P.Size }} bytes</p> |
| 29 | <a class="link" href="/{{ .RepoName }}/raw/{{ .P.Ref }}/{{ .P.Path }}" download>[ Download ]</a> |
| 30 | </div> |
| 31 | {{ else }} |
| 32 | <table class="file-contents" tabindex="-1"> |
| 33 | <tbody> |
| 34 | {{- range $i, $l := .P.Lines }} |
| 35 | <tr class="line"> |
| 36 | <td class="line-number"> |
| 37 | <a id="L{{ inc $i }}" href="#L{{ inc $i }}" aria>{{ inc $i }}</a> |
| 38 | </td> |
| 39 | <td><pre>{{ $l }}</pre></td> |
| 40 | </tr> |
| 41 | {{- end -}} |
| 42 | </tbody> |
| 43 | </table> |
| 44 | {{ end }} |
| 45 | </div> |
| 46 | </main> |
| 47 | </body> |
| 48 | </html> |
| 49 | {{ end }} |