Use details blocks to hide subpages in the list.

This commit is contained in:
Feufochmar 2022-05-23 12:09:44 +02:00
parent 2c2ed3448e
commit ac7bd07b98
1 changed files with 17 additions and 10 deletions

View File

@ -114,6 +114,10 @@
(define notes (if connected-usr (get-all-notes) (get-public-notes)))
; Get the notes as a tree
(define note-tree (note-list->tree notes))
; Show a link
(define (link-to-note n)
`(a ((href ,(note-link 'show (note-name n))))
,(displayed-name (note-title n) (note-public? n))))
;
`(article
,(if (null? notes)
@ -121,16 +125,19 @@
(tree-fold
note-tree
(lambda (n children)
(if n
(append
`(div
((class "notepad-page-list-entry"))
(a ((href ,(note-link 'show (note-name n))))
,(displayed-name (note-title n) (note-public? n))))
(reverse children))
(append
'(div)
(reverse children))))))
(cond
((and n (not (null? children)))
`(details
((class "notepad-page-list-entry"))
(summary
,(link-to-note n))
,@(reverse children)))
((and n (null? children))
`(div ((class "notepad-page-list-entry")) ,(link-to-note n)))
((null? children)
'())
(#t
`(div ,@(reverse children)))))))
,@(if connected-usr
'((hr)
(a ((href "/notes/edit")) "Ajouter une note"))