view: issue-page: Show comment form.
authorRicardo Wurmus <rekado@elephly.net>
Sun, 5 Apr 2020 22:08:59 +0000 (00:08 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Sun, 5 Apr 2020 22:08:59 +0000 (00:08 +0200)
mumi/web/view/html.scm

index 9771deebdaacfe071eadc02b057076c8a4a7bd98..d7b04d0fd27955faa6a5f3dae677b6ca0f4bf5d6 100644 (file)
@@ -22,6 +22,7 @@
   #:use-module (mumi config)
   #:use-module (mumi messages)
   #:use-module (mumi web view utils)
+  #:use-module (mumi web util)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-19)
@@ -446,19 +447,50 @@ some examples.")
           (@ (class "message"))
           (div
            (@ (class "card"))
-           (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
+           ,@(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)))))))))
+                       (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)))))))))))
 
        (div
         (@ (class "info col-md-3"))