all repos — legit @ e4d12fc667c9830dd5f08f827b2a70adff58a09b

fork of git.icyphox.sh/legit

templates/tree.html

{{ define "tree" }}
<html>
  <title>{{ .name }}
    {{ if .parent }}
    &mdash; {{ .parent }}
    {{ end }}
  </title>
{{ template "head" . }}

  {{ template "repoheader" . }}
  <body>
    {{ template "nav" . }}
    <main>
      {{ $repo := .name }}
      {{ $ref := .ref }}
      {{ $parent := .parent }}

      <div class="tree">
        {{ if $parent }}
        <div></div>
        <div><a href="../">..</a></div>
        {{ end }}
        {{ range .files }}
        <div class="mode">{{ .Mode }}</div>
        <div>
        {{ if .IsFile }}
          {{ if $parent }}
          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
          {{ else }}
          <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
          {{ end }}
        {{ else }}
          {{ if $parent }}
          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
          {{ else }}
          <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
          {{ end }}
        {{ end }}
        </div>
        {{ end }}
      </div>
      <article>
        <pre>
          {{- if .readme }}{{ .readme }}{{- end -}}
        </pre>
      </article>
    </main>
  </body>
</html>
{{ end }}