summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-08-25 18:22:28 +0200
committerGravatar Tom Willemsen2012-08-25 18:22:28 +0200
commit138c65c01b3db178a1bd2ce4c94f3d371955e055 (patch)
tree3ce56f77c3e1f6f728ae0d19b8e4f94ab8b19eba
parenta08ae0c9a77d315cffc1e7101a17acbb1eaa71df (diff)
downloadtekuti-138c65c01b3db178a1bd2ce4c94f3d371955e055.tar.gz
tekuti-138c65c01b3db178a1bd2ce4c94f3d371955e055.zip
Basic bootstrap layout
* tekuti/config.scm (*bootstrap-base*): New setting. This variable should be a relative or absolute URL to the location of the bootstrap base, where the `css', `img' and `js' directories containing the correct files. * tekuti/page.scm (page-index): Place the `main-sidebar' in a column next to the main text instead of above it. * tekuti/template.scm (templatize): Make the template more bootstrappy.
-rw-r--r--tekuti/config.scm5
-rw-r--r--tekuti/page.scm11
-rw-r--r--tekuti/template.scm42
3 files changed, 40 insertions, 18 deletions
diff --git a/tekuti/config.scm b/tekuti/config.scm
index 65fd182..7042796 100644
--- a/tekuti/config.scm
+++ b/tekuti/config.scm
@@ -29,8 +29,8 @@
#:use-module ((sxml ssax) #:select (define-parsed-entity!))
#:export (*public-host* *public-port* *public-path-base*
*private-host* *private-port* *private-path-base*
- *git-dir* *git* *debug* *admin-user* *admin-pass*
- *css-file* *navbar-links* *navbar-infix*
+ *bootstrap-base* *git-dir* *git* *debug* *admin-user*
+ *admin-pass* *css-file* *navbar-links* *navbar-infix*
*title* *subtitle* *name*
*server-impl* *server-impl-args*))
@@ -42,6 +42,7 @@
(define *private-port* 8080)
(define *private-path-base* '())
+(define *bootstrap-base* "/bootstrap")
(define *git-dir* "~/blog.git")
(define *git* "git")
(define *css-file* "/base.css")
diff --git a/tekuti/page.scm b/tekuti/page.scm
index 58ad45e..75ef70f 100644
--- a/tekuti/page.scm
+++ b/tekuti/page.scm
@@ -185,10 +185,13 @@
#:redirect (relurl '("admin")))))))
(define (page-index request body index)
- (respond `(,(main-sidebar request index)
- ,@(map (lambda (post)
- (show-post post #f))
- (latest-posts index #:limit 10)))
+ (respond `((div (@ (class "row"))
+ (div (@ (class "span9"))
+ ,@(map (lambda (post)
+ (show-post post #f))
+ (latest-posts index #:limit 10)))
+ (div (@ (class "span3"))
+ ,(main-sidebar request index))))
#:etag (assq-ref index 'master)))
(define (page-show-post request body index year month day post)
diff --git a/tekuti/template.scm b/tekuti/template.scm
index 79293ef..c472b12 100644
--- a/tekuti/template.scm
+++ b/tekuti/template.scm
@@ -43,18 +43,34 @@
(cond ((null? in) (reverse out))
(else (lp (cdr in) (cons* (car in) infix out)))))))
(define (make-navbar)
- (if (null? *navbar-links*)
- '()
- `((div (@ (id "navbar"))
- ,@(list-join
- (map (lambda (x) `(a (@ (href ,(cdr x))) ,(car x)))
- *navbar-links*)
- *navbar-infix*)))))
+ `((div (@ (class "navbar navbar-inverse navbar-fixed-top"))
+ (div (@ (class "navbar-inner"))
+ (div (@ (class "container"))
+ (a (@ (class "btn btn-navbar")
+ (data-toggle "collapse")
+ (data-target ".nav-collapse"))
+ (span (@ (class "icon-bar")) "")
+ (span (@ (class "icon-bar")) "")
+ (span (@ (class "icon-bar")) ""))
+ (a (@ (class "brand")
+ (href "/"))
+ ,*title*)
+ (div (@ (class "nav-collapse collapse"))
+ (ul (@ (class "nav"))
+ ,(if (null? *navbar-links*)
+ '()
+ (map (lambda (x)
+ `(li (a (@ (href ,(cdr x)))
+ ,(car x))))
+ *navbar-links*)))))))))
`(html
(head (title ,title)
(meta (@ (name "Generator")
(content "An unholy concoction of parenthetical guile")))
(link (@ (rel "stylesheet")
+ (href ,*bootstrap-base* "/css/bootstrap.min.css")))
+ (style "body { padding-top: 60px; }")
+ (link (@ (rel "stylesheet")
(type "text/css")
(media "screen")
(href ,*css-file*)))
@@ -63,12 +79,14 @@
(title ,*title*)
(href ,(relurl `("feed" "atom"))))))
(body
- (div (@ (id "rap"))
- (h1 (@ (id "header"))
- (a (@ ,(href "")) ,*title*))
- ,@(make-navbar)
+ ,@(make-navbar)
+ (div (@ (class "container"))
(div (@ (id "content")) ,@body)
(div (@ (id "footer"))
"powered by "
(a (@ (href "http://wingolog.org/software/tekuti/"))
- "tekuti"))))))
+ "tekuti")
+ ", "
+ (a (@ (href "http://twitter.github.com/bootstrap/"))
+ "bootstrap")))
+ (script (@ (src ,*bootstrap-base* "/js/bootstrap.min.js"))))))