[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/10: Extract out the compare form controls
From: |
Christopher Baines |
Subject: |
07/10: Extract out the compare form controls |
Date: |
Sat, 21 Nov 2020 16:11:44 -0500 (EST) |
cbaines pushed a commit to branch master
in repository data-service.
commit 56983eb03e9ed10eae740194e4013b437dab0b54
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sat Nov 21 20:25:26 2020 +0000
Extract out the compare form controls
So they can be used for the package derivations page
---
guix-data-service/web/compare/html.scm | 73 ++++++++++++++++++----------------
1 file changed, 38 insertions(+), 35 deletions(-)
diff --git a/guix-data-service/web/compare/html.scm
b/guix-data-service/web/compare/html.scm
index 825d0a7..4406d1d 100644
--- a/guix-data-service/web/compare/html.scm
+++ b/guix-data-service/web/compare/html.scm
@@ -31,6 +31,43 @@
compare/packages
compare-invalid-parameters))
+(define (compare-form-controls-for-mode mode query-parameters)
+ (cond
+ ((eq? mode 'revision)
+ (list
+ (form-horizontal-control
+ "Base commit" query-parameters
+ #:required? #t
+ #:help-text "The commit to use as the basis for the comparison."
+ #:font-family "monospace")
+ (form-horizontal-control
+ "Target commit" query-parameters
+ #:required? #t
+ #:help-text "The commit to compare against the base commit."
+ #:font-family "monospace")))
+ ((eq? mode 'datetime)
+ (list
+ (form-horizontal-control
+ "Base branch" query-parameters
+ #:required? #t
+ #:help-text "The branch to compare from."
+ #:font-family "monospace")
+ (form-horizontal-control
+ "Base datetime" query-parameters
+ #:help-text "The date and time to compare from."
+ #:font-family "monospace")
+ (form-horizontal-control
+ "Target branch" query-parameters
+ #:required? #t
+ #:help-text "The branch to compare to."
+ #:font-family "monospace")
+ (form-horizontal-control
+ "Target datetime" query-parameters
+ #:help-text "The date and time to compare to."
+ #:font-family "monospace")))
+ (else
+ '())))
+
(define (compare query-parameters
mode
cgit-url-bases
@@ -112,41 +149,7 @@
(action "")
(style "padding-bottom: 0")
(class "form-horizontal"))
- ,@(cond
- ((eq? mode 'revision)
- (list
- (form-horizontal-control
- "Base commit" query-parameters
- #:required? #t
- #:help-text "The commit to use as the basis for the
comparison."
- #:font-family "monospace")
- (form-horizontal-control
- "Target commit" query-parameters
- #:required? #t
- #:help-text "The commit to compare against the base commit."
- #:font-family "monospace")))
- ((eq? mode 'datetime)
- (list
- (form-horizontal-control
- "Base branch" query-parameters
- #:required? #t
- #:help-text "The branch to compare from."
- #:font-family "monospace")
- (form-horizontal-control
- "Base datetime" query-parameters
- #:help-text "The date and time to compare from."
- #:font-family "monospace")
- (form-horizontal-control
- "Target branch" query-parameters
- #:required? #t
- #:help-text "The branch to compare to."
- #:font-family "monospace")
- (form-horizontal-control
- "Target datetime" query-parameters
- #:help-text "The date and time to compare to."
- #:font-family "monospace")))
- (else
- '()))
+ ,@(compare-form-controls-for-mode mode query-parameters)
,(form-horizontal-control
"Locale" query-parameters
#:name "locale"
- branch master updated (3e15900 -> e93da1a), Christopher Baines, 2020/11/21
- 01/10: Avoid crashing when no compare arguments are provided, Christopher Baines, 2020/11/21
- 04/10: Improve the comparison page interface, Christopher Baines, 2020/11/21
- 02/10: Avoid errors in form-horizontal-control, Christopher Baines, 2020/11/21
- 03/10: Specify an invalid parameter message in parse-datetime, Christopher Baines, 2020/11/21
- 05/10: Add default datetimes for compare-by-datetime, Christopher Baines, 2020/11/21
- 06/10: Fix some links on the compare page, Christopher Baines, 2020/11/21
- 09/10: Consolidate the package derivation comparison code, Christopher Baines, 2020/11/21
- 08/10: Start merging the package derivation comparison code, Christopher Baines, 2020/11/21
- 07/10: Extract out the compare form controls,
Christopher Baines <=
- 10/10: Fix the JSON link on the compare package derivations page, Christopher Baines, 2020/11/21