diff options
author | Christopher Baines <mail@cbaines.net> | 2019-09-21 12:41:39 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-09-21 12:41:39 +0100 |
commit | 1181d999a9acb8a82845dc397d84fc7f944c5ab2 (patch) | |
tree | 791e10f3dc09d85dc63aa4a774462c4b0d90990e | |
parent | f5ff0f86383031072b0448f7b6d0b1221d5c45f9 (diff) | |
download | data-service-1181d999a9acb8a82845dc397d84fc7f944c5ab2.tar data-service-1181d999a9acb8a82845dc397d84fc7f944c5ab2.tar.gz |
Serve the README.html file on the site
-rw-r--r-- | guix-data-service/config.scm.in | 7 | ||||
-rw-r--r-- | guix-data-service/web/controller.scm | 3 | ||||
-rw-r--r-- | guix-data-service/web/view/html.scm | 21 |
3 files changed, 31 insertions, 0 deletions
diff --git a/guix-data-service/config.scm.in b/guix-data-service/config.scm.in index 20323c6..ab34254 100644 --- a/guix-data-service/config.scm.in +++ b/guix-data-service/config.scm.in @@ -30,6 +30,13 @@ (if (file-exists? install-dir) install-dir dev-dir))) + (doc-dir . ,(let ((install-dir + "@prefix@/share/doc/guix-data-service") + (dev-dir + (getcwd))) + (if (file-exists? install-dir) + install-dir + dev-dir))) (host . "localhost") (port . 8765) diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 423f4c0..55a136e 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -720,6 +720,9 @@ #t) 200 500)))) + (('GET "README") + (render-html + #:sxml (readme))) (_ (with-postgresql-connection "web" diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index 622c692..d0b480b 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -23,12 +23,14 @@ #:use-module (guix-data-service web util) #:use-module (ice-9 vlist) #:use-module (ice-9 match) + #:use-module (ice-9 textual-ports) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) #:use-module (texinfo) #:use-module (texinfo html) #:use-module (json) #:export (index + readme general-not-found unknown-revision view-statistics @@ -221,6 +223,25 @@ '()))) '()))))) +(define (readme) + (layout + #:body + `(,(header) + (div + (@ (class "container")) + (div + (@ (class "row")) + (div + (@ (class "col-sm-12")) + (h1 "The README document"))) + (div + (@ (class "row")) + (div + (@ (class "col-sm-12")) + (raw ,(call-with-input-file + (string-append (%config 'doc-dir) "/README.html") + get-string-all)))))))) + (define (index git-repositories-and-revisions) (layout #:body |