legit/templates/tree.html

66 lines
1.6 KiB
HTML
Raw Permalink Normal View History

2022-12-17 16:03:04 +00:00
{{ define "tree" }}
<html>
<title>{{ .name }}
{{ if .parent }}
&mdash; {{ .parent }}
{{ end }}
</title>
{{ template "head" . }}
<body>
2023-02-04 16:34:21 +00:00
{{ template "repoheader" . }}
2022-12-17 16:03:04 +00:00
{{ 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 }}
2023-02-04 16:34:21 +00:00
</table>
2022-12-17 16:03:04 +00:00
<article>
<pre>
{{- if .readme }}{{ .readme }}{{- end -}}
</pre>
</article>
</main>
</body>
2023-02-04 16:34:21 +00:00
{{ template "footer" .meta }}
2022-12-17 16:03:04 +00:00
</html>
{{ end }}