diff options
author | Christopher Baines <mail@cbaines.net> | 2022-01-31 20:25:06 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-01-31 20:25:06 +0000 |
commit | 752d21ad051900561a13dc6cb6543ea586b90baa (patch) | |
tree | 689492a3259a58b92835a8e6a9d23a15a562f24f /guix-data-service/web/revision | |
parent | f1418c4e88e9fc77e9a450fa1c01471e897774f3 (diff) | |
download | data-service-752d21ad051900561a13dc6cb6543ea586b90baa.tar data-service-752d21ad051900561a13dc6cb6543ea586b90baa.tar.gz |
Improve the way the field fields work on various pages
Remove the brackets from the values since this makes the set of values more
consistent, and don't display the no additional fields value on the page.
Diffstat (limited to 'guix-data-service/web/revision')
-rw-r--r-- | guix-data-service/web/revision/html.scm | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm index eeb2fc8..d8769e6 100644 --- a/guix-data-service/web/revision/html.scm +++ b/guix-data-service/web/revision/html.scm @@ -549,14 +549,18 @@ any-translations-available? #:key path-base header-text header-link) + (define fields + '("Version" "Synopsis" "Description" + "Home page" "Location" "Licenses")) + (define field-options (map (lambda (field) (cons field (hyphenate-words - (string-downcase field)))) - '("Version" "Synopsis" "Description" - "Home page" "Location" "Licenses"))) + (remove-brackets + (string-downcase field))))) + `("(no additional fields)" ,@fields))) (layout #:title @@ -642,12 +646,12 @@ (tr (th (@ (class "col-md-3")) "Name") ,@(filter-map - (match-lambda - ((label . value) - (if (member value (assq-ref query-parameters 'field)) - `(th (@ (class "col-md-3")) ,label) - #f))) - field-options) + (lambda (field) + (if (member (assoc-ref field-options field) + (assq-ref query-parameters 'field)) + `(th (@ (class "col-md-3")) ,field) + #f)) + fields) (th (@ (class "col-md-3")) ""))) (tbody ,@(let ((fields (assq-ref query-parameters 'field))) @@ -1543,7 +1547,8 @@ figure { (lambda (field) (cons field (hyphenate-words - (string-downcase field)))) + (remove-brackets + (string-downcase field))))) '("(no additional fields)" "System" "Target" "Builds"))) (define fields @@ -2210,13 +2215,17 @@ figure { any-translated-lint-warnings? #:key path-base header-text header-link) + (define fields + '("Linter" "Message" "Location")) + (define field-options (map (lambda (field) (cons field (hyphenate-words - (string-downcase field)))) - '("Linter" "Message" "Location"))) + (remove-brackets + (string-downcase field))))) + `("(no additional fields)" ,@fields))) (layout #:title @@ -2300,12 +2309,12 @@ figure { (tr (th (@ (class "col-md-3")) "Package") ,@(filter-map - (match-lambda - ((label . value) - (if (member value (assq-ref query-parameters 'field)) - `(th (@ (class "col-md-3")) ,label) - #f))) - field-options) + (lambda (field) + (if (member (assoc-ref field-options field) + (assq-ref query-parameters 'field)) + `(th (@ (class "col-md-3")) ,field) + #f)) + fields) (th (@ (class "col-md-3")) ""))) (tbody ,@(let ((fields (assq-ref query-parameters 'field))) |