Bootstrap admin page
This commit is contained in:
parent
35c56844aa
commit
4258614af9
2 changed files with 71 additions and 41 deletions
|
@ -154,42 +154,69 @@
|
|||
(form (@ (method "POST")
|
||||
(action ,(if post
|
||||
(relurl `("admin" "modify-post" ,(post-key post)))
|
||||
(relurl '("admin" "new-post")))))
|
||||
(p (input (@ (name "title") (type "text")
|
||||
(value ,(if post (post-title post) ""))))
|
||||
(label (@ (for "title")) " <- title"))
|
||||
(p (input (@ (name "tags") (type "text")
|
||||
(relurl '("admin" "new-post"))))
|
||||
(class "form-horizontal"))
|
||||
(div (@ (class "control-group"))
|
||||
(label (@ (class "control-label") (for "title")) "Title")
|
||||
(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
|
||||
(string-join (post-tags post) ", ")
|
||||
""))))
|
||||
(label (@ (for "tags")) " <- tags, comma-separated"))
|
||||
(p (input (@ (name "date") (type "text")
|
||||
(string-join (post-tags post)
|
||||
", ")
|
||||
""))
|
||||
(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?)
|
||||
(timestamp->rfc822-date (post-timestamp post))
|
||||
""))))
|
||||
(label (@ (for "date")) " <- date (empty == now)"))
|
||||
(p (input (@ (name "comments") (type "checkbox")
|
||||
,@(if (or (not post) (post-comments-open? post))
|
||||
(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")) '())))
|
||||
(label (@ (for "comments")) " comments open?"))
|
||||
(div (textarea (@ (name "body") (rows "20") (cols "60"))
|
||||
,(if post (post-raw-content post) "")))
|
||||
" 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")))
|
||||
(value "publish")
|
||||
(class "btn btn-primary")))
|
||||
" "
|
||||
(input (@ (type "submit") (name "status")
|
||||
(value "draft"))))
|
||||
(value "draft") (class "btn"))))))
|
||||
,@(if post
|
||||
`((form (@ (method "POST")
|
||||
(action ,(relurl `("admin" "delete-post" ,(post-key post)))))
|
||||
" "
|
||||
(input (@ (type "submit") (name "delete") (value "delete"))))
|
||||
,@(let ((l (comments-sxml-content-edit post)))
|
||||
(if (null? l) l
|
||||
`((h2 "comments")
|
||||
(ol (@ (class "commentlist")) ,@l))))
|
||||
(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)
|
||||
|
|
|
@ -83,14 +83,17 @@
|
|||
`(li ,(rellink `("admin" "changes" ,(car rev))
|
||||
(caddr rev))))
|
||||
(git-rev-list "refs/heads/master" n)))
|
||||
(respond `(,(sidebar-ul `((li (h2 "posts " ,(rellink '("admin" "posts")
|
||||
">>"))
|
||||
(ul ,@(post-links 5)))
|
||||
(li (h2 "changes" ,(rellink '("admin" "changes")
|
||||
">>"))
|
||||
(ul ,(recent-changes 5)))))
|
||||
(respond `((div (@ (class "row"))
|
||||
(div (@ (class "span9"))
|
||||
(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)
|
||||
(with-authentication
|
||||
|
|
Loading…
Reference in a new issue