From baae0f305f1cbbe1de0da084c6fb05a9f289571f Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 6 May 2020 11:05:53 +0200 Subject: view: Define comment-box. --- mumi/web/view/html.scm | 111 +++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 54 deletions(-) diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm index da3b519..f6ab518 100644 --- a/mumi/web/view/html.scm +++ b/mumi/web/view/html.scm @@ -399,6 +399,61 @@ failed to process associated messages.") ((? number? n) (list (number->string n))))))))) '())))) + (define comment-box + `(div + (@ (class "comment-box")) + (a (@ (id "comment"))) + (div + (@ (class "avatar") + (style "background-color:#bc80bd")) "?") + (div + (@ (class "message")) + (div + (@ (class "card")) + ,@(if (mailer-enabled?) + `((form + (@ (action ,(format #f "/issue/~a/comment" + (number->string id))) + (enctype "multipart/form-data") + (method "POST")) + (input (@ (style "display:none") + (name "validation") + (placeholder "Please leave this empty.")) "") + (input (@ (type "hidden") + (name "timestamp") + (value ,(timestamp!))) "") + (div + (@ (class "card-header")) + (div (@ (class "from")) + (input (@ (class "address form-control") + (name "from") + (required "required") + (placeholder "Your name")) ""))) + (div + (@ (class "body card-body")) + (textarea (@ (name "text") + (required "required") + (class "form-control") + (placeholder "Please input your comment...")) + "")) + (div + (@ (class "card-footer")) + (button (@ (class "btn btn-primary") + (type "submit")) + "Send")))) + `((div + (@ (class "card-header")) + (div (@ (class "from")) + (span (@ (class "address")) "Your comment"))) + (div + (@ (class "body card-body")) + (p "Comments via the web interface are not currently +supported. To comment on this conversation " + (a (@ (href ,(string-append "mailto:" + (number->string id) "@" (%config 'debbugs-domain) + "?subject=" (bug-subject* bug)))) + ,(string-append "send email to " + (number->string id) "@" (%config 'debbugs-domain))))))))))) (define (show-message message-number message previous-subject) `((div (@ (class "mb-5")) (a (@ (id ,(number->string message-number)))) @@ -453,6 +508,7 @@ failed to process associated messages.") (@ (class "col-11 offset-1 text-center")) (div (@ (class "badge badge-primary closed")) "Closed")))) '()))) + (if (null? messages) #f (layout #:title (bug-subject* bug) @@ -491,60 +547,7 @@ failed to process associated messages.") msgs (cons (bug-subject* bug) (map subject msgs)))) - (div - (@ (class "comment-box")) - (a (@ (id "comment"))) - (div - (@ (class "avatar") - (style "background-color:#bc80bd")) "?") - (div - (@ (class "message")) - (div - (@ (class "card")) - ,@(if (mailer-enabled?) - `((form - (@ (action ,(format #f "/issue/~a/comment" - (number->string id))) - (enctype "multipart/form-data") - (method "POST")) - (input (@ (style "display:none") - (name "validation") - (placeholder "Please leave this empty.")) "") - (input (@ (type "hidden") - (name "timestamp") - (value ,(timestamp!))) "") - (div - (@ (class "card-header")) - (div (@ (class "from")) - (input (@ (class "address form-control") - (name "from") - (required "required") - (placeholder "Your name")) ""))) - (div - (@ (class "body card-body")) - (textarea (@ (name "text") - (required "required") - (class "form-control") - (placeholder "Please input your comment...")) - "")) - (div - (@ (class "card-footer")) - (button (@ (class "btn btn-primary") - (type "submit")) - "Send")))) - `((div - (@ (class "card-header")) - (div (@ (class "from")) - (span (@ (class "address")) "Your comment"))) - (div - (@ (class "body card-body")) - (p "Comments via the web interface are not currently -supported. To comment on this conversation " - (a (@ (href ,(string-append "mailto:" - (number->string id) "@" (%config 'debbugs-domain) - "?subject=" (bug-subject* bug)))) - ,(string-append "send email to " - (number->string id) "@" (%config 'debbugs-domain))))))))))))))))) + ,comment-box))))))) (define (list-of-bugs bugs) "Return table rows for all BUGS." -- cgit v1.2.3