Sortable tables

This commit is contained in:
Tony Garnock-Jones 2014-11-08 20:06:38 -05:00
parent e9f9b6a303
commit 5bcdaeabed
7 changed files with 66 additions and 51 deletions

View File

@ -7,8 +7,6 @@ Want to be able to see packages with build problems, and packages without build
Some way of getting a list of all packages
- "you should have the "285 package in the index" have a link like "hiding main-distribution (show)""
Want to be able to sort result tables
you should be able to specify git repos over http/https
you should be able to specify subdirs in git repos
you should check the existence of repos/github repos/urls/etc via XHR

View File

@ -50,8 +50,7 @@
(link ((rel "stylesheet") (href "/bootstrap/css/bootstrap.min.css") (type "text/css")))
(link ((rel "stylesheet") (href "/style.css") (type "text/css")))
,@(for/list ((sheet (bootstrap-page-stylesheets)))
`(link ((rel "stylesheet") (href ,sheet) (type "text/css"))))
(script ((type "text/javascript") (src "/site.js"))))
`(link ((rel "stylesheet") (href ,sheet) (type "text/css")))))
(body
(nav ((class "navbar navbar-inverse navbar-fixed-top") (role "navigation"))
(div ((class "container"))
@ -72,9 +71,10 @@
,title-element
,@body-contents)
(script ((type "text/javascript")
(src "https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js")))
(script ((type "text/javascript") (src "/jquery.min.js")))
(script ((type "text/javascript") (src "/jquery.tablesorter.min.js")))
(script ((type "text/javascript") (src "/bootstrap/js/bootstrap.min.js")))
(script ((type "text/javascript") (src "/site.js")))
,@(for/list ((script (bootstrap-page-scripts)))
`(script ((type "text/javascript") (src ,script))))))))

View File

@ -411,51 +411,53 @@
(define now (/ (current-inexact-milliseconds) 1000))
`(table
((class "packages sortable"))
(tr
(th "Package")
(th "Description")
(th "Build"))
,@(maybe-splice (null? package-names)
`(tr (td ((colspan "3"))
(div ((class "alert alert-info"))
"No packages found."))))
,@(for/list ((package-name package-names))
(define pkg (package-detail package-name))
`(tr
(td (h2 ,(package-link package-name))
,(authors-list (@ pkg authors))
,@(maybe-splice
(< (- now (or (@ pkg last-updated) 0)) recent-seconds)
`(span ((class "label label-info")) "Updated"))
)
(td (p ,(@ pkg description))
,@(maybe-splice
(pair? (@ pkg build docs))
`(div
(span ((class "doctags-label")) "Docs: ")
,(doc-links (@ pkg build docs))))
,@(maybe-splice
(pair? (@ pkg tags))
`(div
(span ((class "doctags-label")) "Tags: ")
,(tag-links (@ pkg tags)))))
,(cond
[(@ pkg build failure-log)
`(td ((class "build_red"))
,(buildhost-link (@ pkg build failure-log) "fails"))]
[(and (@ pkg build success-log)
(@ pkg build dep-failure-log))
`(td ((class "build_yellow"))
,(buildhost-link (@ pkg build success-log)
"succeeds")
" with "
,(buildhost-link (@ pkg build dep-failure-log)
"dependency problems"))]
[(@ pkg build success-log)
`(td ((class "build_green"))
,(buildhost-link (@ pkg build success-log) "succeeds"))]
[else
`(td)])))))
(thead
(tr
(th "Package")
(th "Description")
(th "Build")))
(tbody
,@(maybe-splice (null? package-names)
`(tr (td ((colspan "3"))
(div ((class "alert alert-info"))
"No packages found."))))
,@(for/list ((package-name package-names))
(define pkg (package-detail package-name))
`(tr
(td (h2 ,(package-link package-name))
,(authors-list (@ pkg authors))
,@(maybe-splice
(< (- now (or (@ pkg last-updated) 0)) recent-seconds)
`(span ((class "label label-info")) "Updated"))
)
(td (p ,(@ pkg description))
,@(maybe-splice
(pair? (@ pkg build docs))
`(div
(span ((class "doctags-label")) "Docs: ")
,(doc-links (@ pkg build docs))))
,@(maybe-splice
(pair? (@ pkg tags))
`(div
(span ((class "doctags-label")) "Tags: ")
,(tag-links (@ pkg tags)))))
,(cond
[(@ pkg build failure-log)
`(td ((class "build_red"))
,(buildhost-link (@ pkg build failure-log) "fails"))]
[(and (@ pkg build success-log)
(@ pkg build dep-failure-log))
`(td ((class "build_yellow"))
,(buildhost-link (@ pkg build success-log)
"succeeds")
" with "
,(buildhost-link (@ pkg build dep-failure-log)
"dependency problems"))]
[(@ pkg build success-log)
`(td ((class "build_green"))
,(buildhost-link (@ pkg build success-log) "succeeds"))]
[else
`(td)]))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

4
static/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

4
static/jquery.tablesorter.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
$(document).ready(function () {
$("table.sortable").tablesorter();
});

View File

@ -94,3 +94,7 @@ input#new_version {
font-size: 100%;
text-decoration: none;
}
/* Sortable tables */
th.headerSortUp::after { content: " ▲"; }
th.headerSortDown::after { content: " ▼"; }