summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-05-06 11:02:59 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-05-06 11:02:59 +0200
commita304dbdaa83c81b39b31dc78b3e20befe1ec616c (patch)
tree239da581c19d06b7d741a3ef322c48f8124fb632
parentee851947627f52f6104c29d71e761f4fd90d4fca (diff)
view: Define issue details.
-rw-r--r--mumi/web/view/html.scm166
1 files changed, 84 insertions, 82 deletions
diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm
index 8f6307f..da3b519 100644
--- a/mumi/web/view/html.scm
+++ b/mumi/web/view/html.scm
@@ -316,6 +316,89 @@ failed to process associated messages.")
(lambda (a b)
(string< (extract-email a)
(extract-email b)))))
+ (define issue-details
+ `(span (@ (class "details"))
+ ,(status-tag bug)
+ ,(string-append "Submitted by "
+ ;; We don't use bug-originator here
+ ;; because it includes the email address.
+ ;; We cannot use extract-name on the
+ ;; return value, because it swallows
+ ;; non-ASCII characters.
+ (sender-name (first messages))
+ ".")
+ (details
+ (@ (class "info"))
+ (summary "Details")
+ (dl
+ (@ (class "stat"))
+ ,@(let ((num (length parties)))
+ `((dt ,(if (= num 1)
+ "One participant"
+ (string-append (number->string num)
+ " participants")))
+ (dd
+ (ul ,(map (lambda (name)
+ `(li (span (@ (class "name")))
+ ,name))
+ (map extract-name parties)))))))
+ (dl
+ (@ (class "stat"))
+ (dt "Owner")
+ (dd
+ ,(or (and=> (bug-owner bug) extract-name) "unassigned")))
+ (dl
+ (@ (class "stat"))
+ (dt "Severity")
+ (dd ,(bug-severity bug)))
+ ,@(if (bug-mergedwith bug)
+ `((dl
+ (@ (class "stat"))
+ (dt "Merged with")
+ (dd (ul ,(map (lambda (id)
+ `(li (a (@ (href ,(string-append "/" id)))
+ ,id)))
+ ;; XXX: This field can either hold a
+ ;; string of multiple ids, or a single
+ ;; number. Deal with this mess.
+ (match (bug-mergedwith bug)
+ ((? string? str)
+ (string-split str #\space))
+ ((? number? n)
+ (list (number->string n)))))))))
+ '())
+ ,@(if (bug-blocks bug)
+ `((dl
+ (@ (class "stat"))
+ (dt "Blocks")
+ (dd (ul ,(map (lambda (id)
+ `(li (a (@ (href ,(string-append "/" id)))
+ ,id)))
+ ;; XXX: This field can either hold a
+ ;; string of multiple ids, or a single
+ ;; number. Deal with this mess.
+ (match (bug-blocks bug)
+ ((? string? str)
+ (string-split str #\space))
+ ((? number? n)
+ (list (number->string n)))))))))
+ '())
+ ,@(if (bug-blockedby bug)
+ `((dl
+ (@ (class "stat"))
+ (dt "Blocked by")
+ (dd (ul ,(map (lambda (id)
+ `(li (a (@ (href ,(string-append "/" id)))
+ ,id)))
+ ;; XXX: This field can either hold a
+ ;; string of multiple ids, or a single
+ ;; number. Deal with this mess.
+ (match (bug-blockedby bug)
+ ((? string? str)
+ (string-split str #\space))
+ ((? number? n)
+ (list (number->string n)))))))))
+ '()))))
(define (show-message message-number message previous-subject)
`((div (@ (class "mb-5"))
(a (@ (id ,(number->string message-number))))
@@ -390,88 +473,7 @@ failed to process associated messages.")
(div
(@ (class "title col-12"))
(h1 (@ (class "h3")) ,(bug-subject* bug))
- (span (@ (class "details"))
- ,(status-tag bug)
- ,(string-append "Submitted by "
- ;; We don't use bug-originator here
- ;; because it includes the email address.
- ;; We cannot use extract-name on the
- ;; return value, because it swallows
- ;; non-ASCII characters.
- (sender-name (first messages))
- ".")
- (details
- (@ (class "info"))
- (summary "Details")
- (dl
- (@ (class "stat"))
- ,@(let ((num (length parties)))
- `((dt ,(if (= num 1)
- "One participant"
- (string-append (number->string num)
- " participants")))
- (dd
- (ul ,(map (lambda (name)
- `(li (span (@ (class "name")))
- ,name))
- (map extract-name parties)))))))
- (dl
- (@ (class "stat"))
- (dt "Owner")
- (dd
- ,(or (and=> (bug-owner bug) extract-name) "unassigned")))
- (dl
- (@ (class "stat"))
- (dt "Severity")
- (dd ,(bug-severity bug)))
- ,@(if (bug-mergedwith bug)
- `((dl
- (@ (class "stat"))
- (dt "Merged with")
- (dd (ul ,(map (lambda (id)
- `(li (a (@ (href ,(string-append "/" id)))
- ,id)))
- ;; XXX: This field can either hold a
- ;; string of multiple ids, or a single
- ;; number. Deal with this mess.
- (match (bug-mergedwith bug)
- ((? string? str)
- (string-split str #\space))
- ((? number? n)
- (list (number->string n)))))))))
- '())
- ,@(if (bug-blocks bug)
- `((dl
- (@ (class "stat"))
- (dt "Blocks")
- (dd (ul ,(map (lambda (id)
- `(li (a (@ (href ,(string-append "/" id)))
- ,id)))
- ;; XXX: This field can either hold a
- ;; string of multiple ids, or a single
- ;; number. Deal with this mess.
- (match (bug-blocks bug)
- ((? string? str)
- (string-split str #\space))
- ((? number? n)
- (list (number->string n)))))))))
- '())
- ,@(if (bug-blockedby bug)
- `((dl
- (@ (class "stat"))
- (dt "Blocked by")
- (dd (ul ,(map (lambda (id)
- `(li (a (@ (href ,(string-append "/" id)))
- ,id)))
- ;; XXX: This field can either hold a
- ;; string of multiple ids, or a single
- ;; number. Deal with this mess.
- (match (bug-blockedby bug)
- ((? string? str)
- (string-split str #\space))
- ((? number? n)
- (list (number->string n)))))))))
- '()))))
+ ,issue-details)
(div (@ (class "row"))
(div
(@ (class "conversation col-12"))