use table for tree view as it is more compatible with eg w3m and netsurf

This commit is contained in:
Iris Lightshard 2023-02-03 17:56:23 -07:00
parent fd41ddefb0
commit 839be3691d
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 38 additions and 24 deletions

View file

@ -123,14 +123,20 @@ a:hover {
font-style: italic; font-style: italic;
} }
.tree { .tree td {
display: grid; padding: 0.5em 0.5ch;
grid-template-columns: 10ch auto 1fr; box-sizing: content-box;
grid-row-gap: 0.5em;
grid-column-gap: 1em;
min-width: 0;
} }
.mode, .size {
font-family: var(--mono-font);
width: 10ch;
white-space: nowrap;
}
.size {
text-align: right;
width: 15ch;
}
.log { .log {
display: grid; display: grid;
grid-template-columns: 20rem minmax(0, 1fr); grid-template-columns: 20rem minmax(0, 1fr);
@ -145,12 +151,7 @@ a:hover {
white-space: pre-wrap; white-space: pre-wrap;
} }
.mode, .size {
font-family: var(--mono-font);
}
.size {
text-align: right;
}
.readme pre { .readme pre {
white-space: pre-wrap; white-space: pre-wrap;
@ -314,6 +315,7 @@ a:hover {
width: 100%; width: 100%;
} }
} }
.diff-type { .diff-type {
color: var(--gray); color: var(--gray);
} }
@ -351,3 +353,9 @@ a:hover {
font-size: 0.8rem; font-size: 0.8rem;
} }
} }
@media (max-width: 420px) {
.tree .size {
display: none;
}
}

View file

@ -15,36 +15,42 @@
{{ $ref := .ref }} {{ $ref := .ref }}
{{ $parent := .parent }} {{ $parent := .parent }}
<div class="tree"> <table class="tree">
{{ if $parent }} {{ if $parent }}
<div></div> <tr>
<div></div> <td></td>
<div><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></div> <td></td>
<td><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></td>
</tr>
{{ end }} {{ end }}
{{ range .files }} {{ range .files }}
{{ if not .IsFile }} {{ if not .IsFile }}
<div class="mode">{{ .Mode }}</div> <tr>
<div class="size">{{ .Size }}</div> <td class="mode">{{ .Mode }}</td>
<div> <td class="size">{{ .Size }}</td>
<td>
{{ if $parent }} {{ if $parent }}
<a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a> <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
{{ else }} {{ else }}
<a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a> <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
{{ end }} {{ end }}
</div> </td>
</tr>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range .files }} {{ range .files }}
{{ if .IsFile }} {{ if .IsFile }}
<div class="mode">{{ .Mode }}</div> <tr>
<div class="size">{{ .Size }}</div> <td class="mode">{{ .Mode }}</td>
<div> <td class="size">{{ .Size }}</td>
<td>
{{ if $parent }} {{ if $parent }}
<a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a> <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a>
{{ else }} {{ else }}
<a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a> <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a>
{{ end }} {{ end }}
</div> </td>
</tr>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>