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 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)"" - "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 git repos over http/https
you should be able to specify subdirs in git repos you should be able to specify subdirs in git repos
you should check the existence of repos/github repos/urls/etc via XHR 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 "/bootstrap/css/bootstrap.min.css") (type "text/css")))
(link ((rel "stylesheet") (href "/style.css") (type "text/css"))) (link ((rel "stylesheet") (href "/style.css") (type "text/css")))
,@(for/list ((sheet (bootstrap-page-stylesheets))) ,@(for/list ((sheet (bootstrap-page-stylesheets)))
`(link ((rel "stylesheet") (href ,sheet) (type "text/css")))) `(link ((rel "stylesheet") (href ,sheet) (type "text/css")))))
(script ((type "text/javascript") (src "/site.js"))))
(body (body
(nav ((class "navbar navbar-inverse navbar-fixed-top") (role "navigation")) (nav ((class "navbar navbar-inverse navbar-fixed-top") (role "navigation"))
(div ((class "container")) (div ((class "container"))
@ -72,9 +71,10 @@
,title-element ,title-element
,@body-contents) ,@body-contents)
(script ((type "text/javascript") (script ((type "text/javascript") (src "/jquery.min.js")))
(src "https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/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 "/bootstrap/js/bootstrap.min.js")))
(script ((type "text/javascript") (src "/site.js")))
,@(for/list ((script (bootstrap-page-scripts))) ,@(for/list ((script (bootstrap-page-scripts)))
`(script ((type "text/javascript") (src ,script)))))))) `(script ((type "text/javascript") (src ,script))))))))

View File

@ -411,51 +411,53 @@
(define now (/ (current-inexact-milliseconds) 1000)) (define now (/ (current-inexact-milliseconds) 1000))
`(table `(table
((class "packages sortable")) ((class "packages sortable"))
(tr (thead
(th "Package") (tr
(th "Description") (th "Package")
(th "Build")) (th "Description")
,@(maybe-splice (null? package-names) (th "Build")))
`(tr (td ((colspan "3")) (tbody
(div ((class "alert alert-info")) ,@(maybe-splice (null? package-names)
"No packages found.")))) `(tr (td ((colspan "3"))
,@(for/list ((package-name package-names)) (div ((class "alert alert-info"))
(define pkg (package-detail package-name)) "No packages found."))))
`(tr ,@(for/list ((package-name package-names))
(td (h2 ,(package-link package-name)) (define pkg (package-detail package-name))
,(authors-list (@ pkg authors)) `(tr
,@(maybe-splice (td (h2 ,(package-link package-name))
(< (- now (or (@ pkg last-updated) 0)) recent-seconds) ,(authors-list (@ pkg authors))
`(span ((class "label label-info")) "Updated")) ,@(maybe-splice
) (< (- now (or (@ pkg last-updated) 0)) recent-seconds)
(td (p ,(@ pkg description)) `(span ((class "label label-info")) "Updated"))
,@(maybe-splice )
(pair? (@ pkg build docs)) (td (p ,(@ pkg description))
`(div ,@(maybe-splice
(span ((class "doctags-label")) "Docs: ") (pair? (@ pkg build docs))
,(doc-links (@ pkg build docs)))) `(div
,@(maybe-splice (span ((class "doctags-label")) "Docs: ")
(pair? (@ pkg tags)) ,(doc-links (@ pkg build docs))))
`(div ,@(maybe-splice
(span ((class "doctags-label")) "Tags: ") (pair? (@ pkg tags))
,(tag-links (@ pkg tags))))) `(div
,(cond (span ((class "doctags-label")) "Tags: ")
[(@ pkg build failure-log) ,(tag-links (@ pkg tags)))))
`(td ((class "build_red")) ,(cond
,(buildhost-link (@ pkg build failure-log) "fails"))] [(@ pkg build failure-log)
[(and (@ pkg build success-log) `(td ((class "build_red"))
(@ pkg build dep-failure-log)) ,(buildhost-link (@ pkg build failure-log) "fails"))]
`(td ((class "build_yellow")) [(and (@ pkg build success-log)
,(buildhost-link (@ pkg build success-log) (@ pkg build dep-failure-log))
"succeeds") `(td ((class "build_yellow"))
" with " ,(buildhost-link (@ pkg build success-log)
,(buildhost-link (@ pkg build dep-failure-log) "succeeds")
"dependency problems"))] " with "
[(@ pkg build success-log) ,(buildhost-link (@ pkg build dep-failure-log)
`(td ((class "build_green")) "dependency problems"))]
,(buildhost-link (@ pkg build success-log) "succeeds"))] [(@ pkg build success-log)
[else `(td ((class "build_green"))
`(td)]))))) ,(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%; font-size: 100%;
text-decoration: none; text-decoration: none;
} }
/* Sortable tables */
th.headerSortUp::after { content: " ▲"; }
th.headerSortDown::after { content: " ▼"; }