summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-09-10 11:08:48 +0200
committerGravatar Tom Willemsen2012-09-10 11:08:48 +0200
commit5c7f24773c2a9a8966db18ddc2e0f324088372cc (patch)
tree4a6dbb0d5becad2e4fcfd6f2f1540f2758464129
parente9087b948ce1cdb43851a2c18837d83ba17619ac (diff)
parentbe1d54ad32c69ed5577c664da8b4f011f82d281f (diff)
downloadtekuti-5c7f24773c2a9a8966db18ddc2e0f324088372cc.tar.gz
tekuti-5c7f24773c2a9a8966db18ddc2e0f324088372cc.zip
Merge branch 'bootstrap' into personal
-rw-r--r--tekuti/page-helpers.scm173
-rw-r--r--tekuti/page.scm30
2 files changed, 124 insertions, 79 deletions
diff --git a/tekuti/page-helpers.scm b/tekuti/page-helpers.scm
index 194c3ef..66a7b42 100644
--- a/tekuti/page-helpers.scm
+++ b/tekuti/page-helpers.scm
@@ -42,7 +42,7 @@
relurl rellink
post-url
post-editing-form
- sidebar-ul top-tags tag-cloud
+ top-tags tag-cloud
main-sidebar post-sidebar related-tag-cloud
post-link admin-post-url admin-post-link
show-post with-authentication
@@ -154,47 +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))
- '())))
-
-(define (sidebar-ul body)
- `(div (@ (id "menu"))
- (ul ,@body)))
+ ,@(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 (admin-post-url post)
(relurl `("admin" "posts" ,(post-key post))))
@@ -214,25 +237,43 @@
(define (comment-form post author email url comment)
`(form
- (@ (action ,(post-url post)) (method "POST"))
- (p (input (@ (type "text") (name "author") (value ,author)
- (size "22") (tabindex "1")))
- " " (label (@ (for "author")) (small "Name")))
- (p (input (@ (type "text") (name "email") (value ,email)
- (size "22") (tabindex "2")))
- " " (label (@ (for "email")) (small "Mail (will not be published)")))
- (p (input (@ (type "text") (name "url") (value ,url)
- (size "22") (tabindex "3")))
- " " (label (@ (for "url")) (small "Website")))
- (p (input (@ (type "text") (name "x") (value "")
- (size "22") (tabindex "3")))
- " " (label (@ (for "x")) (small "What's your favorite number?")))
- ;(p (small "allowed tags: "))
- (p (textarea (@ (name "comment") (id "comment") (cols "65")
- (rows "10") (tabindex "4"))
- ,comment))
- (p (input (@ (name "submit") (type "submit") (id "submit") (tabindex "5")
- (value "Submit Comment"))))))
+ (@ (action ,(post-url post)) (method "POST")
+ (class "form-horizontal"))
+ (div (@ (class "control-group"))
+ (label (@ (class "control-label") (for "author")) "Name")
+ (div (@ (class "controls"))
+ (input (@ (type "text") (name "author") (id "author")
+ (value ,author) (tabindex "1") (class "span6")
+ (placeholder "Your Name")))))
+ (div (@ (class "control-group"))
+ (label (@ (class "control-label") (for "email"))
+ "Mail (will not be published)")
+ (div (@ (class "controls"))
+ (input (@ (type "text") (name "email") (id "email")
+ (value ,email) (tabindex "2") (class "span6")
+ (placeholder "you@somehost.com")))))
+ (div (@ (class "control-group"))
+ (label (@ (class "control-label") (for "url")) "Website")
+ (div (@ (class "controls"))
+ (input (@ (type "text") (name "url") (id "url")
+ (value ,url) (tabindex "3") (class "span6")
+ (placeholder "http://your.website.com")))))
+ (div (@ (class "control-group"))
+ (label (@ (class "control-label") (for "x"))
+ "What's your favorite number?")
+ (div (@ (class "controls"))
+ (input (@ (type "text") (name "x") (id "x") (value "")
+ (tabindex "3") (class "span6")))))
+ (div (@ (class "control-group"))
+ (div (@ (class "controls"))
+ (textarea (@ (name "comment") (id "comment") (cols "65")
+ (rows "10") (tabindex "4") (class "span6"))
+ ,comment)))
+ (div (@ (class "control-group"))
+ (div (@ (class "controls"))
+ (button (@ (type "submit") (class "btn btn-primary")
+ (name "submit") (id "submit") (tabindex "5"))
+ "Submit Comment")))))
(define (comments-sxml-content-edit post)
(map
@@ -336,17 +377,13 @@
,@(tag-cloud (top-tags index 30))))
(define (post-sidebar post index)
- (sidebar-ul
- `((li (h2 (a (@ (href ,(relurl '("feed" "atom"))))
- "subscribe "
- (img (@ (src ,(relurl '("wp-content" "feed-icon-14x14.png")))
- (alt "[feed]")))
- )))
- (li (h2 "related")
- (ul ,@(map (lambda (post-and-tags)
- `(li (@ (style "margin-top: 5px"))
- ,(post-link (car post-and-tags))))
- (take-max (compute-related-posts post index) 10)))))))
+ `((h2 (a (@ (href ,(relurl '("feed" "atom"))))
+ "subscribe "))
+ (h2 "related")
+ (ul ,@(map (lambda (post-and-tags)
+ `(li (@ (style "margin-top: 5px"))
+ ,(post-link (car post-and-tags))))
+ (take-max (compute-related-posts post index) 10)))))
(define (related-tag-cloud tag index)
`(div (@ (id "tag-cloud"))
diff --git a/tekuti/page.scm b/tekuti/page.scm
index a0bd037..c740b50 100644
--- a/tekuti/page.scm
+++ b/tekuti/page.scm
@@ -84,14 +84,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
@@ -174,7 +177,9 @@
(pre ,(git "diff-tree" "-M" "-p" sha1))
(form (@ (action ,(relurl `("admin" "revert-change" ,sha1)))
(method "POST"))
- (input (@ (type "submit") (value "Undo this change"))))))))))
+ (input (@ (type "submit")
+ (class "btn btn-primary")
+ (value "Undo this change"))))))))))
(define (page-admin-revert-change request body index sha1)
@@ -202,8 +207,11 @@
(cond
((post-from-key index (make-post-key year month day post))
=> (lambda (post)
- (respond `(,(post-sidebar post index)
- ,(show-post post #t))
+ (respond `((div (@ (class "row"))
+ (div (@ (class "span9"))
+ ,(show-post post #t))
+ (div (@ (class "span3"))
+ ,(post-sidebar post index))))
#:title (string-append (post-title post) " -- " *title*)
#:etag (assq-ref index 'master))))
(else