legit/templates/tree.html

60 lines
1.5 KiB
HTML

{{ define "tree" }}
<html>
{{ template "head" . }}
<body>
{{ template "repoheader" . }}
{{ template "nav" . }}
<main>
{{ $repo := .name }}
{{ $ref := .ref }}
{{ $parent := .parent }}
<table class="tree">
{{ if $parent }}
<tr>
<td></td>
<td></td>
<td><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></td>
</tr>
{{ end }}
{{ range .files }}
{{ if not .IsFile }}
<tr>
<td class="mode">{{ .Mode }}</td>
<td class="size">{{ .Size }}</td>
<td>
{{ if $parent }}
<a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
{{ else }}
<a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
{{ end }}
</td>
</tr>
{{ end }}
{{ end }}
{{ range .files }}
{{ if .IsFile }}
<tr>
<td class="mode">{{ .Mode }}</td>
<td class="size">{{ .Size }}</td>
<td>
{{ if $parent }}
<a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
{{ else }}
<a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
{{ end }}
</td>
</tr>
{{ end }}
{{ end }}
</table>
<article>
<pre>
{{- if .readme }}{{ .readme }}{{- end -}}
</pre>
</article>
</main>
</body>
{{ template "footer" .meta }}
</html>
{{ end }}