[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/04: Improve the way the field fields work on various pages
From: |
Christopher Baines |
Subject: |
02/04: Improve the way the field fields work on various pages |
Date: |
Mon, 31 Jan 2022 15:28:39 -0500 (EST) |
cbaines pushed a commit to branch master
in repository data-service.
commit 752d21ad051900561a13dc6cb6543ea586b90baa
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Mon Jan 31 20:25:06 2022 +0000
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.
---
guix-data-service/web/compare/html.scm | 3 ++-
guix-data-service/web/revision/html.scm | 45 ++++++++++++++++++++-------------
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/guix-data-service/web/compare/html.scm
b/guix-data-service/web/compare/html.scm
index 128e3f4..17272e3 100644
--- a/guix-data-service/web/compare/html.scm
+++ b/guix-data-service/web/compare/html.scm
@@ -680,7 +680,8 @@
(lambda (field)
(cons field
(hyphenate-words
- (string-downcase field))))
+ (remove-brackets
+ (string-downcase field)))))
'("(no additional fields)" "Builds")))
(define fields
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)))