summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/css/screen.css8
-rw-r--r--assets/img/spin.gifbin0 -> 4210 bytes
-rw-r--r--assets/js/mumi.js19
-rw-r--r--mumi/web/controller.scm6
-rw-r--r--mumi/web/view/html.scm32
5 files changed, 55 insertions, 10 deletions
diff --git a/assets/css/screen.css b/assets/css/screen.css
index 73dceae..012d359 100644
--- a/assets/css/screen.css
+++ b/assets/css/screen.css
@@ -93,6 +93,14 @@ tr td:nth-child(3){
min-width: 8rem;
}
+tr.serious td:nth-child(1) {
+ background-color: #ff5a2a;
+ color: #fff;
+}
+tr.important td:nth-child(1) {
+ background-color: #feaaaa;
+}
+
#header {
background: #333333;
border-color: #1A1A1A1A;
diff --git a/assets/img/spin.gif b/assets/img/spin.gif
new file mode 100644
index 0000000..00bce1a
--- /dev/null
+++ b/assets/img/spin.gif
Binary files differ
diff --git a/assets/js/mumi.js b/assets/js/mumi.js
new file mode 100644
index 0000000..317bdcf
--- /dev/null
+++ b/assets/js/mumi.js
@@ -0,0 +1,19 @@
+// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3.0-or-later
+(function () {
+ var loadSnippet = function (targetId, URL) {
+ var req = new XMLHttpRequest();
+ req.onload = function (e) {
+ var target = document.getElementById(targetId);
+ target.innerHTML = req.responseText;
+ };
+ req.onerror = function (e) {
+ var target = document.getElementById(targetId);
+ target.innerHTML = "Never mind...";
+ };
+ req.open('GET', URL, true);
+ req.send();
+ };
+ loadSnippet ('snippet-recent', '/snippet/recent');
+ loadSnippet ('snippet-priority', '/snippet/priority');
+})();
+// @license-end
diff --git a/mumi/web/controller.scm b/mumi/web/controller.scm
index ad6c63a..910c4e7 100644
--- a/mumi/web/controller.scm
+++ b/mumi/web/controller.scm
@@ -1,5 +1,5 @@
;;; mumi -- Mediocre, uh, mail interface
-;;; Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU Affero General Public License
@@ -110,6 +110,10 @@
(map string->number path)))
((GET "issue" not-an-id)
(apply render-html (unknown not-an-id)))
+ ((GET "snippet" "recent")
+ (apply render-html (list #:sxml (list-of-bugs (recent-bugs 10)))))
+ ((GET "snippet" "priority")
+ (apply render-html (priority-bugs)))
((GET "help")
(apply render-html (help)))
((GET path ...)
diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm
index ee660c6..8cb811f 100644
--- a/mumi/web/view/html.scm
+++ b/mumi/web/view/html.scm
@@ -1,5 +1,5 @@
;;; mumi -- Mediocre, uh, mail interface
-;;; Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This program is free software: you can redistribute it and/or
@@ -29,7 +29,9 @@
unknown
error-page
issue-page
- list-of-matching-bugs))
+ list-of-matching-bugs
+ list-of-bugs
+ priority-bugs))
(define (status-tag bug)
"Return a colored tag indicating the BUG status."
@@ -156,12 +158,15 @@
", and "
(a (@ (href "help#search"))
"many more!"))))
- ;; TODO: do this via JS?
- ,@(let ((bugs (recent-bugs 5)))
- (if (null? bugs)
- '()
- `((h2 "Recent activity")
- ,(list-of-bugs bugs))))))))
+ (h2 "Recent activity")
+ (div (@ (id "snippet-recent"))
+ (img (@ (src "/img/spin.gif"))))
+ (h2 "Priority bugs")
+ (div (@ (id "snippet-priority"))
+ (img (@ (src "/img/spin.gif"))))
+ (script
+ (@ (type "text/javascript")
+ (src "/js/mumi.js")))))))
(define (help)
(layout
@@ -416,7 +421,7 @@ supported. To comment on this conversation "
(tbody
,@(map (lambda (bug)
(let ((id (number->string (bug-num bug))))
- `(tr
+ `(tr (@ (class ,(bug-severity bug)))
(td ,(or id "-"))
(td ,(if id
`(a (@ (href ,(string-append "/issue/" id)))
@@ -426,6 +431,15 @@ supported. To comment on this conversation "
(td ,(status-tag bug)))))
bugs)))))
+(define (priority-bugs)
+ (list #:sxml
+ (list-of-bugs
+ (sort
+ (append
+ (bugs-by-severity "serious" "open")
+ (bugs-by-severity "important" "open"))
+ (lambda (a b) (< (bug-num a) (bug-num b)))))))
+
(define (list-of-matching-bugs query bugs)
(layout
#:body