From 138c65c01b3db178a1bd2ce4c94f3d371955e055 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 25 Aug 2012 18:22:28 +0200 Subject: 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. --- tekuti/config.scm | 5 +++-- tekuti/page.scm | 11 +++++++---- tekuti/template.scm | 42 ++++++++++++++++++++++++++++++------------ 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,17 +43,33 @@ (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") @@ -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")))))) -- cgit v1.2.3-54-g00ecf