Show subfolders separately
Recurse into subfolders when showing project list.
This commit is contained in:
parent
d2f68a3423
commit
cf5d90a257
1 changed files with 29 additions and 22 deletions
|
@ -19,12 +19,11 @@
|
|||
(list name (map remove-stat children)))))
|
||||
|
||||
(define (list-projects)
|
||||
(let ((start #t))
|
||||
(cadr (remove-stat (file-system-tree
|
||||
*projects-dir*
|
||||
(lambda params
|
||||
(and start
|
||||
(begin (set! start #f) #t))))))))
|
||||
(remove-stat
|
||||
(file-system-tree
|
||||
*projects-dir*
|
||||
(lambda (name stat)
|
||||
(not (file-exists? (string-append name "/config")))))))
|
||||
|
||||
(define (project-description project)
|
||||
(let ((dfile-name
|
||||
|
@ -49,21 +48,29 @@
|
|||
"never"
|
||||
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)
|
||||
(respond `((table (@ (class "table table-condensed table-striped"))
|
||||
(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)))))
|
||||
(respond (project-list->table (list-projects) 1)
|
||||
#:extra-headers '((pragma . (no-cache (broccoli . "tastyy"))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue