summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-05 18:27:54 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-05 18:28:44 +0200
commit2db5f3d9ec5d32f7e91deca089caa59e9c247ad1 (patch)
tree90f65c39bc50bbdf7dbc5f62dd687950c8bf8fc6
parentec255e3a7b4cedc2f3a6bac463732545fff0143f (diff)
Let issue-page display an optional flash message.
-rw-r--r--mumi/web/controller.scm2
-rw-r--r--mumi/web/view/html.scm12
2 files changed, 12 insertions, 2 deletions
diff --git a/mumi/web/controller.scm b/mumi/web/controller.scm
index e420311..56b8eaf 100644
--- a/mumi/web/controller.scm
+++ b/mumi/web/controller.scm
@@ -90,7 +90,7 @@
'(error . "There was an error submitting your comment!"))
(_ #f))))
(apply render-html (or (and=> (fetch-bug id)
- issue-page)
+ (lambda (bug) (issue-page bug message)))
(unknown id)))))
(('GET "issue" (? string->number id)
"attachment" (? string->number msg-num)
diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm
index 2f73b01..cbc907d 100644
--- a/mumi/web/view/html.scm
+++ b/mumi/web/view/html.scm
@@ -289,7 +289,7 @@ some examples.")
,message
(p (a (@ (href "/")) "Try something else?"))))))
-(define (issue-page bug)
+(define* (issue-page bug #:optional flash-message)
"Render the conversation for the given BUG."
(define id (bug-num bug))
(define messages (patch-messages id))
@@ -367,6 +367,16 @@ some examples.")
`(,(header)
(div
(@ (class "container"))
+ ,@(match flash-message
+ (('error . text)
+ `((div (@ (class "alert alert-danger")
+ (role "alert"))
+ ,text)))
+ (('info . text)
+ `((div (@ (class "alert alert-info")
+ (role "alert"))
+ ,text)))
+ (_ '()))
(div
(@ (class "title col-md-12"))
(h1 ,(bug-subject* bug))