From 22995e5655b3d5117743d98bf5c7ba8ed335a2c5 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 20 May 2019 15:46:34 -0600 Subject: Implement most of browse; fix a couple obvious bugs; some cleanup --- modules/caddyhttp/staticfiles/browsetpl.go | 403 +++++++++++++++++++++++++++++ 1 file changed, 403 insertions(+) create mode 100644 modules/caddyhttp/staticfiles/browsetpl.go (limited to 'modules/caddyhttp/staticfiles/browsetpl.go') diff --git a/modules/caddyhttp/staticfiles/browsetpl.go b/modules/caddyhttp/staticfiles/browsetpl.go new file mode 100644 index 0000000..ff2a1e1 --- /dev/null +++ b/modules/caddyhttp/staticfiles/browsetpl.go @@ -0,0 +1,403 @@ +package staticfiles + +const defaultBrowseTemplate = ` + + + {{html .Name}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ {{range $i, $crumb := .Breadcrumbs}}{{html $crumb.Text}}{{if ne $i 0}}/{{end}}{{end}} +

+
+
+
+
+ {{.NumDirs}} director{{if eq 1 .NumDirs}}y{{else}}ies{{end}} + {{.NumFiles}} file{{if ne 1 .NumFiles}}s{{end}} + {{- if ne 0 .ItemsLimitedTo}} + (of which only {{.ItemsLimitedTo}} are displayed) + {{- end}} + +
+
+
+ + + + + + + + + + + + {{- if .CanGoUp}} + + + + + + + + {{- end}} + {{- range .Items}} + + + + {{- if .IsDir}} + + {{- else}} + + {{- end}} + + + + {{- end}} + +
+ {{- if and (eq .Sort "namedirfirst") (ne .Order "desc")}} + + {{- else if and (eq .Sort "namedirfirst") (ne .Order "asc")}} + + {{- else}} + + {{- end}} + + {{- if and (eq .Sort "name") (ne .Order "desc")}} + Name + {{- else if and (eq .Sort "name") (ne .Order "asc")}} + Name + {{- else}} + Name + {{- end}} + + {{- if and (eq .Sort "size") (ne .Order "desc")}} + Size + {{- else if and (eq .Sort "size") (ne .Order "asc")}} + Size + {{- else}} + Size + {{- end}} + + {{- if and (eq .Sort "time") (ne .Order "desc")}} + Modified + {{- else if and (eq .Sort "time") (ne .Order "asc")}} + Modified + {{- else}} + Modified + {{- end}} +
+ + Go up + +
+ + {{- if .IsDir}} + + {{- else}} + + {{- end}} + {{html .Name}} + + {{.HumanSize}}
+
+
+ + + +` -- cgit v1.2.3