Use details blocks to hide subpages in the list.
This commit is contained in:
parent
2c2ed3448e
commit
ac7bd07b98
|
@ -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"))
|
||||
|
|
Loading…
Reference in New Issue