aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-03-15 02:05:10 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-03-28 14:17:01 +0200
commit05ccd049c5161cdfa7ec04ed9b38077a45314bc0 (patch)
tree856ddbaa49170b8aaf1f7a31d88638236653068a
parentHTML directory table now gives 404 instead of 500 (diff)
downloadcalp-05ccd049c5161cdfa7ec04ed9b38077a45314bc0.tar.gz
calp-05ccd049c5161cdfa7ec04ed9b38077a45314bc0.tar.xz
Introduce directory-listing.scss
-rw-r--r--module/calp/server/routes.scm9
-rw-r--r--static/Makefile2
-rw-r--r--static/directory-listing.scss5
3 files changed, 11 insertions, 5 deletions
diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm
index 2e282f91..ee1f3cb2 100644
--- a/module/calp/server/routes.scm
+++ b/module/calp/server/routes.scm
@@ -48,7 +48,7 @@
;; Note that the exported url is currently hard-coded to
;; start with /static.
(define (directory-table prefix dir)
- `(table
+ `(table (@ (class "directory-table"))
(thead
(tr (th "") (th "Name") (th "Perm") (th "Size")))
(tbody
@@ -72,8 +72,6 @@
(td (a (@ (href ,(path-append "/static" dir k)))
,k))
(td ,(number->string (stat:perms stat) 8))
- ;; TODO replace with stylesheet containing
- ;; td:nth-child(3} { text-align: end; }
(td (@ (style "text-align:end"))
(data (@ (value ,(stat:size stat)))
,(format #f "~:d" (stat:size stat)))))))
@@ -480,7 +478,10 @@
(lambda () (return
'((content-type text/html))
(sxml->html-string
- (directory-table (static-dir) path))))
+ `(html
+ (head (title "Calp directory listing for " path)
+ ,((@ (calp html components) include-css) "/static/directory-listing.css"))
+ (body ,(directory-table (static-dir) path))))))
(lambda (err proc fmt fmt-args data)
(return (build-response code: 404)
(format #f "~?" fmt fmt-args)))))
diff --git a/static/Makefile b/static/Makefile
index 2897c6bb..1979575d 100644
--- a/static/Makefile
+++ b/static/Makefile
@@ -1,6 +1,6 @@
.PHONY: all install clean watch
-TARGETS := style.css smallcal.css script.out.js
+TARGETS := style.css smallcal.css script.out.js directory-listing.css
WATCH=
# script explicitly named, since that is our entry point
diff --git a/static/directory-listing.scss b/static/directory-listing.scss
new file mode 100644
index 00000000..745b5bc3
--- /dev/null
+++ b/static/directory-listing.scss
@@ -0,0 +1,5 @@
+@import 'global';
+
+.directory-table td:nth-child(3) {
+ text-align: end;
+}