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.
This commit is contained in:
Christopher Baines 2022-01-31 20:25:06 +00:00
parent f1418c4e88
commit 752d21ad05
2 changed files with 29 additions and 19 deletions

View file

@ -680,7 +680,8 @@
(lambda (field) (lambda (field)
(cons field (cons field
(hyphenate-words (hyphenate-words
(string-downcase field)))) (remove-brackets
(string-downcase field)))))
'("(no additional fields)" "Builds"))) '("(no additional fields)" "Builds")))
(define fields (define fields

View file

@ -549,14 +549,18 @@
any-translations-available? any-translations-available?
#:key path-base #:key path-base
header-text header-link) header-text header-link)
(define fields
'("Version" "Synopsis" "Description"
"Home page" "Location" "Licenses"))
(define field-options (define field-options
(map (map
(lambda (field) (lambda (field)
(cons field (cons field
(hyphenate-words (hyphenate-words
(string-downcase field)))) (remove-brackets
'("Version" "Synopsis" "Description" (string-downcase field)))))
"Home page" "Location" "Licenses"))) `("(no additional fields)" ,@fields)))
(layout (layout
#:title #:title
@ -642,12 +646,12 @@
(tr (tr
(th (@ (class "col-md-3")) "Name") (th (@ (class "col-md-3")) "Name")
,@(filter-map ,@(filter-map
(match-lambda (lambda (field)
((label . value) (if (member (assoc-ref field-options field)
(if (member value (assq-ref query-parameters 'field)) (assq-ref query-parameters 'field))
`(th (@ (class "col-md-3")) ,label) `(th (@ (class "col-md-3")) ,field)
#f))) #f))
field-options) fields)
(th (@ (class "col-md-3")) ""))) (th (@ (class "col-md-3")) "")))
(tbody (tbody
,@(let ((fields (assq-ref query-parameters 'field))) ,@(let ((fields (assq-ref query-parameters 'field)))
@ -1543,7 +1547,8 @@ figure {
(lambda (field) (lambda (field)
(cons field (cons field
(hyphenate-words (hyphenate-words
(string-downcase field)))) (remove-brackets
(string-downcase field)))))
'("(no additional fields)" "System" "Target" "Builds"))) '("(no additional fields)" "System" "Target" "Builds")))
(define fields (define fields
@ -2210,13 +2215,17 @@ figure {
any-translated-lint-warnings? any-translated-lint-warnings?
#:key path-base #:key path-base
header-text header-link) header-text header-link)
(define fields
'("Linter" "Message" "Location"))
(define field-options (define field-options
(map (map
(lambda (field) (lambda (field)
(cons field (cons field
(hyphenate-words (hyphenate-words
(string-downcase field)))) (remove-brackets
'("Linter" "Message" "Location"))) (string-downcase field)))))
`("(no additional fields)" ,@fields)))
(layout (layout
#:title #:title
@ -2300,12 +2309,12 @@ figure {
(tr (tr
(th (@ (class "col-md-3")) "Package") (th (@ (class "col-md-3")) "Package")
,@(filter-map ,@(filter-map
(match-lambda (lambda (field)
((label . value) (if (member (assoc-ref field-options field)
(if (member value (assq-ref query-parameters 'field)) (assq-ref query-parameters 'field))
`(th (@ (class "col-md-3")) ,label) `(th (@ (class "col-md-3")) ,field)
#f))) #f))
field-options) fields)
(th (@ (class "col-md-3")) ""))) (th (@ (class "col-md-3")) "")))
(tbody (tbody
,@(let ((fields (assq-ref query-parameters 'field))) ,@(let ((fields (assq-ref query-parameters 'field)))