1
0
Fork 0

Bootstrap admin page

This commit is contained in:
Tom Willemsen 2012-09-10 10:58:32 +02:00
parent 35c56844aa
commit 4258614af9
2 changed files with 71 additions and 41 deletions

View file

@ -154,43 +154,70 @@
(form (@ (method "POST") (form (@ (method "POST")
(action ,(if post (action ,(if post
(relurl `("admin" "modify-post" ,(post-key post))) (relurl `("admin" "modify-post" ,(post-key post)))
(relurl '("admin" "new-post"))))) (relurl '("admin" "new-post"))))
(p (input (@ (name "title") (type "text") (class "form-horizontal"))
(value ,(if post (post-title post) "")))) (div (@ (class "control-group"))
(label (@ (for "title")) " <- title")) (label (@ (class "control-label") (for "title")) "Title")
(p (input (@ (name "tags") (type "text") (div (@ (class "controls"))
(value ,(if post (input (@ (type "text") (name "title") (id "title")
(string-join (post-tags post) ", ") (value ,(if post (post-title post) ""))
"")))) (class "span6")
(label (@ (for "tags")) " <- tags, comma-separated")) (placeholder "New post")))))
(p (input (@ (name "date") (type "text") (div (@ (class "control-group"))
(value ,(if (and=> post post-published?) (label (@ (class "control-label") (for "tags"))
(timestamp->rfc822-date (post-timestamp post)) "Tags, comma-separated")
"")))) (div (@ (class "controls"))
(label (@ (for "date")) " <- date (empty == now)")) (input (@ (type "text") (name "tags") (id "tags")
(p (input (@ (name "comments") (type "checkbox") (value ,(if post
,@(if (or (not post) (post-comments-open? post)) (string-join (post-tags post)
`((checked "checked")) '()))) ", ")
(label (@ (for "comments")) " comments open?")) ""))
(div (textarea (@ (name "body") (rows "20") (cols "60")) (class "span6")))))
,(if post (post-raw-content post) ""))) (div (@ (class "control-group"))
(input (@ (type "submit") (name "status") (label (@ (class "control-label") (for "date"))
(value "publish"))) "Date (empty == now)")
" " (div (@ (class "controls"))
(input (@ (type "submit") (name "status") (input (@ (type "text") (name "date") (id "date")
(value "draft")))) (value ,(if (and=> post post-published?)
(timestamp->rfc822-date
(post-timestamp post))
""))
(class "span6") (placeholder "Now")))))
(div (@ (class "control-group"))
(div (@ (class "controls"))
(label (@ (class "checkbox"))
(input (@ (type "checkbox") (name "comments")
,@(if
(or (not post)
(post-comments-open? post))
`((checked "checked")) '())))
" comments open?")))
(div (@ (class "control-group"))
(div (@ (class "controls"))
(textarea (@ (name "body") (rows "20") (cols "60")
(class "span6"))
,(if post (post-raw-content post) ""))))
(div (@ (class "control-group"))
(div (@ (class "controls"))
(input (@ (type "submit") (name "status")
(value "publish")
(class "btn btn-primary")))
" "
(input (@ (type "submit") (name "status")
(value "draft") (class "btn"))))))
,@(if post ,@(if post
`((form (@ (method "POST") `((form (@ (method "POST")
(action ,(relurl `("admin" "delete-post" ,(post-key post))))) (action ,(relurl `("admin" "delete-post" ,(post-key post)))))
" " " "
(input (@ (type "submit") (name "delete") (value "delete")))) ,@(let ((l (comments-sxml-content-edit post)))
,@(let ((l (comments-sxml-content-edit post))) (if (null? l) l
(if (null? l) l `((h2 "comments")
`((h2 "comments") (ol (@ (class "commentlist")) ,@l))))
(ol (@ (class "commentlist")) ,@l)))) (h2 "preview")
(h2 "preview") ,(show-post post #f)
,(show-post post #f)) (input (@ (type "submit") (name "delete")
'()))) (value "delete") (class "btn btn-primary")))))
'())))
(define (sidebar-ul body) (define (sidebar-ul body)
`(div (@ (id "menu")) `(div (@ (id "menu"))

View file

@ -83,14 +83,17 @@
`(li ,(rellink `("admin" "changes" ,(car rev)) `(li ,(rellink `("admin" "changes" ,(car rev))
(caddr rev)))) (caddr rev))))
(git-rev-list "refs/heads/master" n))) (git-rev-list "refs/heads/master" n)))
(respond `(,(sidebar-ul `((li (h2 "posts " ,(rellink '("admin" "posts") (respond `((div (@ (class "row"))
">>")) (div (@ (class "span9"))
(ul ,@(post-links 5))) (h2 "new post")
(li (h2 "changes" ,(rellink '("admin" "changes") ,(post-editing-form #f))
">>")) (div (@ (class "span3"))
(ul ,(recent-changes 5))))) (h2 "posts " ,(rellink '("admin" "posts")
(h2 "new post") ">>"))
,(post-editing-form #f)))))) (ul ,@(post-links 5))
(h2 "changes " ,(rellink '("admin" "changes")
">>"))
(ul ,(recent-changes 5)))))))))
(define (page-admin-posts request body index) (define (page-admin-posts request body index)
(with-authentication (with-authentication