1
0
Fork 0

Show subfolders separately

Recurse into subfolders when showing project list.
This commit is contained in:
Tom Willemsen 2012-09-11 21:44:34 +02:00
parent d2f68a3423
commit cf5d90a257

View file

@ -19,12 +19,11 @@
(list name (map remove-stat children))))) (list name (map remove-stat children)))))
(define (list-projects) (define (list-projects)
(let ((start #t)) (remove-stat
(cadr (remove-stat (file-system-tree (file-system-tree
*projects-dir* *projects-dir*
(lambda params (lambda (name stat)
(and start (not (file-exists? (string-append name "/config")))))))
(begin (set! start #f) #t))))))))
(define (project-description project) (define (project-description project)
(let ((dfile-name (let ((dfile-name
@ -49,21 +48,29 @@
"never" "never"
relative-last-update))) relative-last-update)))
(define (project->row project)
`(tr
(td ,project)
(td ,(project-description project))
(td ,(git-last-update project))
(td "")))
(define (project-list->table list lvl)
(let ((head (car list))
(body (cadr list)))
`((,(string->symbol (string-append "h" (number->string lvl))) ,head)
(table (@ (class "table table-condensed table-striped"))
(thead
(tr
(th "Name")
(th "Description")
(th "Last update")
(th "")))
(tbody
,@(map project->row (filter string? body))))
,@(map (lambda (elt) (project-list->table elt (1+ lvl)))
(filter list? body)))))
(define (page-projects request body index) (define (page-projects request body index)
(respond `((table (@ (class "table table-condensed table-striped")) (respond (project-list->table (list-projects) 1)
(thead
(tr
(th "Name")
(th "Description")
(th "Last update")
(th "")))
(tbody
,@(map
(lambda (elt)
`(tr
(td ,elt)
(td ,(project-description elt))
(td ,(git-last-update elt))
(td "")))
(list-projects)))))
#:extra-headers '((pragma . (no-cache (broccoli . "tastyy")))))) #:extra-headers '((pragma . (no-cache (broccoli . "tastyy"))))))