summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2022-12-24 22:16:52 +0100
committerRicardo Wurmus <rekado@elephly.net>2022-12-24 22:16:52 +0100
commit4361d69de393a55ad27574d10d7c6ad62477a13e (patch)
tree154d19d02a2bb258eafde7bb106d48d3f956d65d
parent53b930002b82d3103482f4c9080b2a89d0f4fa14 (diff)
Fix table sort of dates.
Fixes <https://issues.guix.gnu.org/47739>.
-rw-r--r--assets/js/sort-table.js14
-rw-r--r--mumi/web/view/html.scm15
2 files changed, 22 insertions, 7 deletions
diff --git a/assets/js/sort-table.js b/assets/js/sort-table.js
index b0f0e62..26fbc49 100644
--- a/assets/js/sort-table.js
+++ b/assets/js/sort-table.js
@@ -9,6 +9,8 @@
* or http://opensource.org/licenses/MIT
*
* latest version available at https://github.com/tyleruebele/sort-table
+ *
+ * With changes Copyright (c) 2022 Ricardo Wurmus
*/
/**
@@ -174,6 +176,18 @@ sortTable.raw = function(Cell) {
};
/**
+ * Helper function that acts on a sortable data attribute of a table
+ * cell (TD).
+ *
+ * @param Cell A TD DOM object
+ * @returns {Number}
+ */
+sortTable.position = function(Cell) {
+ return Number(Cell.getAttribute('data-js-sort-position'));
+};
+
+
+/**
* Helper function that converts a table cell (TD) to a comparable value
* Captures the last space-delimited token from innerHTML
*
diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm
index 7154585..6b675e5 100644
--- a/mumi/web/view/html.scm
+++ b/mumi/web/view/html.scm
@@ -268,7 +268,7 @@ simple query language. Here is a list of supported query terms:")
(tr (@ (class "heading"))
(th (@ (class "js-sort-number")) "ID")
(th "Subject")
- (th "Date submitted")
+ (th (@ (class "js-sort-position")) "Date submitted")
(th "Status")))
(tbody
,@(list-of-bugs (recent-bugs 10)))))
@@ -282,7 +282,7 @@ simple query language. Here is a list of supported query terms:")
(tr (@ (class "heading"))
(th (@ (class "js-sort-number")) "ID")
(th "Subject")
- (th "Date submitted")
+ (th (@ (class "js-sort-position")) "Date submitted")
(th "Status")))
(tbody
,@(list-of-bugs (forgotten-issues 10)))))
@@ -295,7 +295,7 @@ simple query language. Here is a list of supported query terms:")
(tr (@ (class "heading"))
(th (@ (class "js-sort-number")) "ID")
(th "Subject")
- (th "Date submitted")
+ (th (@ (class "js-sort-position")) "Date submitted")
(th "Status")))
(tbody
,@(priority-bugs))))))))
@@ -743,7 +743,8 @@ m1 3H6v5h2V4zm0 6H6v2h2v-2z")))))
`(a (@ (href ,(string-append "/" id)))
,(bug-subject* bug))
(bug-subject* bug)))
- (td ,(date->string (bug-date bug)))
+ (td (@ (data-js-sort-position ,(date->string (bug-date bug) "~s")))
+ ,(date->string (bug-date bug)))
(td ,(status-tag bug)))))
bugs))
@@ -767,7 +768,7 @@ m1 3H6v5h2V4zm0 6H6v2h2v-2z")))))
(tr (@ (class "heading"))
(th (@ (class "js-sort-number")) "ID")
(th "Subject")
- (th "Date submitted")
+ (th (@ (class "js-sort-position")) "Date submitted")
(th "Status")))
(tbody
,@(list-of-bugs (recent-bugs max))))))))
@@ -785,7 +786,7 @@ m1 3H6v5h2V4zm0 6H6v2h2v-2z")))))
(tr (@ (class "heading"))
(th (@ (class "js-sort-number")) "ID")
(th "Subject")
- (th "Date submitted")
+ (th (@ (class "js-sort-position")) "Date submitted")
(th "Status")))
(tbody
,@(list-of-bugs (forgotten-issues max))))))))
@@ -815,7 +816,7 @@ m1 3H6v5h2V4zm0 6H6v2h2v-2z")))))
(tr (@ (class "heading"))
(th (@ (class "js-sort-number")) "ID")
(th "Subject")
- (th "Date submitted")
+ (th (@ (class "js-sort-position")) "Date submitted")
(th "Status")))
(tbody
,@(list-of-bugs bugs))))))))