From bb5b01c9111dfb362da557e8aa5e7c4bc39a8da5 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 19 Jul 2018 19:03:44 +0200 Subject: [PATCH] browse: Improve table layout in Firefox (fixes #2179) (#2221) Current Caddy code used a combination of CSS styles that some mainstream browsers (e.g. Firefox) do not support well: "td:first-child { width: 100%; }" together with "td:last-child { padding-right: 5%; }". The old approach was three columns with: - "Name": 100% width, 5% padding left - "Size": minimal width - "Modified": minimal width, 5% padding right Now the new approach is five columns with: - : 5% width - "Name": 80% width - "Size": minimal width - "Modified": minimal width - : 5% width --- caddyhttp/browse/setup.go | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/caddyhttp/browse/setup.go b/caddyhttp/browse/setup.go index 8692c9f5..fd8a443e 100644 --- a/caddyhttp/browse/setup.go +++ b/caddyhttp/browse/setup.go @@ -146,12 +146,12 @@ header, th:first-child, td:first-child { - padding-left: 5%; + width: 5%; } th:last-child, td:last-child { - padding-right: 5%; + width: 5%; } header { @@ -242,20 +242,20 @@ td { font-size: 14px; } -td:first-child { - width: 100%; +td:nth-child(2) { + width: 80%; } -td:nth-child(2) { +td:nth-child(3) { padding: 0 20px 0 20px; } -th:last-child, -td:last-child { +th:nth-child(4), +td:nth-child(4) { text-align: right; } -td:first-child svg { +td:nth-child(2) svg { position: absolute; } @@ -302,12 +302,12 @@ footer { display: none; } - td:first-child { + td:nth-child(2) { width: auto; } - th:nth-child(2), - td:nth-child(2) { + th:nth-child(3), + td:nth-child(3) { padding-right: 5%; text-align: right; } @@ -391,6 +391,7 @@ footer { + + {{- if .CanGoUp}} + + {{- end}} {{- range .Items}} + {{- end}} + {{- end}}
{{- if and (eq .Sort "namedirfirst") (ne .Order "desc")}} @@ -426,11 +427,13 @@ footer { Modified {{- end}}
Go up @@ -438,10 +441,12 @@ footer {
{{- if .IsDir}} @@ -458,6 +463,7 @@ footer { {{.HumanSize}}