From 4258614af9f6776f3aaa56feab4c78f4b49451ec Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 10 Sep 2012 10:58:32 +0200 Subject: Bootstrap admin page --- tekuti/page-helpers.scm | 93 +++++++++++++++++++++++++++++++------------------ tekuti/page.scm | 19 +++++----- 2 files changed, 71 insertions(+), 41 deletions(-) diff --git a/tekuti/page-helpers.scm b/tekuti/page-helpers.scm index bdaa970..2f99117 100644 --- a/tekuti/page-helpers.scm +++ b/tekuti/page-helpers.scm @@ -154,43 +154,70 @@ (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") - (value ,(if post - (string-join (post-tags post) ", ") - "")))) - (label (@ (for "tags")) " <- tags, comma-separated")) - (p (input (@ (name "date") (type "text") - (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)) - `((checked "checked")) '()))) - (label (@ (for "comments")) " comments open?")) - (div (textarea (@ (name "body") (rows "20") (cols "60")) - ,(if post (post-raw-content post) ""))) - (input (@ (type "submit") (name "status") - (value "publish"))) - " " - (input (@ (type "submit") (name "status") - (value "draft")))) + (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) + ", ") + "")) + (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)) + "")) + (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 `((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)) - '()))) + ,@(let ((l (comments-sxml-content-edit post))) + (if (null? l) l + `((h2 "comments") + (ol (@ (class "commentlist")) ,@l)))) + (h2 "preview") + ,(show-post post #f) + (input (@ (type "submit") (name "delete") + (value "delete") (class "btn btn-primary"))))) + '()))) (define (sidebar-ul body) `(div (@ (id "menu")) diff --git a/tekuti/page.scm b/tekuti/page.scm index 1fa57f7..cf916d5 100644 --- a/tekuti/page.scm +++ b/tekuti/page.scm @@ -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))))) - (h2 "new post") - ,(post-editing-form #f)))))) + (respond `((div (@ (class "row")) + (div (@ (class "span9")) + (h2 "new post") + ,(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 -- cgit v1.2.3-54-g00ecf