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,42 +154,69 @@
(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"))
(input (@ (type "text") (name "title") (id "title")
(value ,(if post (post-title post) ""))
(class "span6")
(placeholder "New post")))))
(div (@ (class "control-group"))
(label (@ (class "control-label") (for "tags"))
"Tags, comma-separated")
(div (@ (class "controls"))
(input (@ (type "text") (name "tags") (id "tags")
(value ,(if post (value ,(if post
(string-join (post-tags post) ", ") (string-join (post-tags post)
"")))) ", ")
(label (@ (for "tags")) " <- tags, comma-separated")) ""))
(p (input (@ (name "date") (type "text") (class "span6")))))
(div (@ (class "control-group"))
(label (@ (class "control-label") (for "date"))
"Date (empty == now)")
(div (@ (class "controls"))
(input (@ (type "text") (name "date") (id "date")
(value ,(if (and=> post post-published?) (value ,(if (and=> post post-published?)
(timestamp->rfc822-date (post-timestamp post)) (timestamp->rfc822-date
"")))) (post-timestamp post))
(label (@ (for "date")) " <- date (empty == now)")) ""))
(p (input (@ (name "comments") (type "checkbox") (class "span6") (placeholder "Now")))))
,@(if (or (not post) (post-comments-open? post)) (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")) '()))) `((checked "checked")) '())))
(label (@ (for "comments")) " comments open?")) " comments open?")))
(div (textarea (@ (name "body") (rows "20") (cols "60")) (div (@ (class "control-group"))
,(if post (post-raw-content post) ""))) (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") (input (@ (type "submit") (name "status")
(value "publish"))) (value "publish")
(class "btn btn-primary")))
" " " "
(input (@ (type "submit") (name "status") (input (@ (type "submit") (name "status")
(value "draft")))) (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)

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)))
(li (h2 "changes" ,(rellink '("admin" "changes")
">>"))
(ul ,(recent-changes 5)))))
(h2 "new post") (h2 "new post")
,(post-editing-form #f)))))) ,(post-editing-form #f))
(div (@ (class "span3"))
(h2 "posts " ,(rellink '("admin" "posts")
">>"))
(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