mugit/web/templates/repo_file.html (view raw)
Oleksandr Smirnov
Oleksandr Smirnov
olexsmir@gmail.com ui: add breadcrumbs to file content view, 3 months ago
olexsmir@gmail.com ui: add breadcrumbs to file content view, 3 months 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="mode">/</span> |
| 14 | {{- if .IsLast -}}{{- .Name -}} |
| 15 | {{- else -}}<a class="link" href="{{ $.RepoName }}/tree/{{ $.P.Ref }}/{{ $.P.Path }}">{{ .Name }}</a>{{- end -}} |
| 16 | {{- end -}} |
| 17 | (<a class="muted" href="?raw=true">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="?raw=true" 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="?raw=true" download>[ Download ]</a> |
| 30 | </div> |
| 31 | {{ else }} |
| 32 | <table> |
| 33 | <tbody> |
| 34 | <tr> |
| 35 | <td class="line-numbers"> |
| 36 | <pre>{{- range .P.LineCount }} |
| 37 | <a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a> |
| 38 | {{- end -}}</pre> |
| 39 | </td> |
| 40 | <td class="file-content"> |
| 41 | <pre>{{- .P.Content -}}</pre> |
| 42 | </td> |
| 43 | </tr> |
| 44 | </tbody> |
| 45 | </table> |
| 46 | {{ end }} |
| 47 | </div> |
| 48 | </main> |
| 49 | </body> |
| 50 | </html> |
| 51 | {{ end }} |