1
0
Fork 0

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.
This commit is contained in:
Tom Willemsen 2012-08-25 18:22:28 +02:00
parent a08ae0c9a7
commit 138c65c01b
3 changed files with 40 additions and 18 deletions

View file

@ -29,8 +29,8 @@
#:use-module ((sxml ssax) #:select (define-parsed-entity!)) #:use-module ((sxml ssax) #:select (define-parsed-entity!))
#:export (*public-host* *public-port* *public-path-base* #:export (*public-host* *public-port* *public-path-base*
*private-host* *private-port* *private-path-base* *private-host* *private-port* *private-path-base*
*git-dir* *git* *debug* *admin-user* *admin-pass* *bootstrap-base* *git-dir* *git* *debug* *admin-user*
*css-file* *navbar-links* *navbar-infix* *admin-pass* *css-file* *navbar-links* *navbar-infix*
*title* *subtitle* *name* *title* *subtitle* *name*
*server-impl* *server-impl-args*)) *server-impl* *server-impl-args*))
@ -42,6 +42,7 @@
(define *private-port* 8080) (define *private-port* 8080)
(define *private-path-base* '()) (define *private-path-base* '())
(define *bootstrap-base* "/bootstrap")
(define *git-dir* "~/blog.git") (define *git-dir* "~/blog.git")
(define *git* "git") (define *git* "git")
(define *css-file* "/base.css") (define *css-file* "/base.css")

View file

@ -185,10 +185,13 @@
#:redirect (relurl '("admin"))))))) #:redirect (relurl '("admin")))))))
(define (page-index request body index) (define (page-index request body index)
(respond `(,(main-sidebar request index) (respond `((div (@ (class "row"))
(div (@ (class "span9"))
,@(map (lambda (post) ,@(map (lambda (post)
(show-post post #f)) (show-post post #f))
(latest-posts index #:limit 10))) (latest-posts index #:limit 10)))
(div (@ (class "span3"))
,(main-sidebar request index))))
#:etag (assq-ref index 'master))) #:etag (assq-ref index 'master)))
(define (page-show-post request body index year month day post) (define (page-show-post request body index year month day post)

View file

@ -43,17 +43,33 @@
(cond ((null? in) (reverse out)) (cond ((null? in) (reverse out))
(else (lp (cdr in) (cons* (car in) infix out))))))) (else (lp (cdr in) (cons* (car in) infix out)))))))
(define (make-navbar) (define (make-navbar)
(if (null? *navbar-links*) `((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*)
'() '()
`((div (@ (id "navbar")) (map (lambda (x)
,@(list-join `(li (a (@ (href ,(cdr x)))
(map (lambda (x) `(a (@ (href ,(cdr x))) ,(car x))) ,(car x))))
*navbar-links*) *navbar-links*)))))))))
*navbar-infix*)))))
`(html `(html
(head (title ,title) (head (title ,title)
(meta (@ (name "Generator") (meta (@ (name "Generator")
(content "An unholy concoction of parenthetical guile"))) (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") (link (@ (rel "stylesheet")
(type "text/css") (type "text/css")
(media "screen") (media "screen")
@ -63,12 +79,14 @@
(title ,*title*) (title ,*title*)
(href ,(relurl `("feed" "atom")))))) (href ,(relurl `("feed" "atom"))))))
(body (body
(div (@ (id "rap"))
(h1 (@ (id "header"))
(a (@ ,(href "")) ,*title*))
,@(make-navbar) ,@(make-navbar)
(div (@ (class "container"))
(div (@ (id "content")) ,@body) (div (@ (id "content")) ,@body)
(div (@ (id "footer")) (div (@ (id "footer"))
"powered by " "powered by "
(a (@ (href "http://wingolog.org/software/tekuti/")) (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"))))))