legit/templates/tree.html

66 lines
1.6 KiB
HTML
Raw Normal View History

2022-12-17 16:03:04 +00:00
{{ define "tree" }}
<html>
<title>{{ .name }}
{{ if .parent }}
&mdash; {{ .parent }}
{{ end }}
</title>
{{ template "head" . }}
2022-12-18 05:12:18 +00:00
{{ template "repoheader" . }}
2022-12-17 16:03:04 +00:00
<body>
{{ template "nav" . }}
<main>
{{ $repo := .name }}
{{ $ref := .ref }}
{{ $parent := .parent }}
<table class="tree">
2022-12-17 16:03:04 +00:00
{{ if $parent }}
<tr>
<td></td>
<td></td>
<td><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></td>
</tr>
2022-12-17 16:03:04 +00:00
{{ end }}
{{ range .files }}
{{ if not .IsFile }}
<tr>
<td class="mode">{{ .Mode }}</td>
<td class="size">{{ .Size }}</td>
<td>
2022-12-17 16:03:04 +00:00
{{ if $parent }}
<a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
{{ else }}
<a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
{{ end }}
</td>
</tr>
2022-12-17 16:03:04 +00:00
{{ 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>
2022-12-17 16:03:04 +00:00
{{ end }}
{{ end }}
2022-12-17 16:03:04 +00:00
</div>
<article>
<pre>
{{- if .readme }}{{ .readme }}{{- end -}}
</pre>
</article>
</main>
</body>
</html>
{{ end }}