diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-08-09 10:06:28 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-08-09 10:06:28 -0400 |
commit | 7f5005a7034952c958df1d84767097778593a1a1 (patch) | |
tree | ab5f90d6def1c785591527c71fc86fe5adf3a918 | |
parent | 5c46082912bac5e5993792183ce6446a06cb8011 (diff) |
Show package inputs when viewing package details.
* guix-web/view.scm (view-package): Display inputs, native inputs, and
propagated inputs when present.
-rw-r--r-- | guix-web/view.scm | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/guix-web/view.scm b/guix-web/view.scm index 35cce29..6898c28 100644 --- a/guix-web/view.scm +++ b/guix-web/view.scm @@ -16,7 +16,9 @@ ;;; <http://www.gnu.org/licenses/>. (define-module (guix-web view) + #:use-module (ice-9 match) #:use-module (json) + #:use-module (web uri) #:use-module (guix licenses) #:use-module (guix packages) #:use-module (gnu packages) @@ -100,7 +102,26 @@ `((div (@ (id "guix")) "") ,@(map script-tag javascripts)))) +;; This should be moved client-side and the server should just serve +;; the relevant JSON. (define (view-package name) + (define (describe-inputs package package-inputs description) + (define (describe-input input) + (match input + ((_ input) + `(li + (a (@ (href ,(string-append + "/" + (encode-and-join-uri-path + `("package" ,(package-name input)))))) + ,(string-append (package-name input) " " + (package-version input))))))) + (let ((inputs (package-inputs package))) + (if (null? inputs) + '() + `((dt ,description) + (dd (ul ,@(map describe-input inputs))))))) + (define (describe-package package) `(dl (dt "Version") @@ -110,7 +131,11 @@ (dt "Description") (dd ,(package-description package)) (dt "License") - (dd ,(render-package-license package)))) + (dd ,(render-package-license package)) + ,@(describe-inputs package package-inputs "Inputs") + ,@(describe-inputs package package-native-inputs "Native Inputs") + ,@(describe-inputs package package-propagated-inputs + "Propagated Inputs"))) (let ((packages (find-packages-by-name name))) (define (format-package-count) |