Skip to content
This repository
tree: dc2f5a1c43
Fetching contributors…

Cannot retrieve contributors at this time

file 46 lines (41 sloc) 1.597 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
(ns labrepl.layout
  (:use [hiccup.core :only (html)]
        [hiccup.page-helpers :only (include-css include-js link-to)]))

(def default-stylesheets
  ["/stylesheets/shCore.css"
   "/stylesheets/shThemeDefault.css"
   "/stylesheets/application.css"])

(def default-javascripts
  ["/javascripts/jquery.js"
   "/javascripts/application.js"
   "/javascripts/shCore.js"
   "/javascripts/shBrushClojure.js"])

(defn home [body]
  (html
    [:head
     [:title "Clojure Labs"]
     (apply include-css default-stylesheets)
     (apply include-js default-javascripts)]
    [:body [:div {:id "header"} [:h2.logo "Clojure Labs"]]
     [:div {:id "content"} body]
     [:div {:id "footer"} "Clojure labrepl. Copyright Relevance Inc. All Rights Reserved."]]))

(defn navigation [link-data]
  [:div {:id "breadcrumb"}
   [:div {:id "previous"} (if-let [prev (:prev link-data)]
                            (link-to (:prev-url link-data) (str "Previous Lab: " prev))
                            (link-to "/" "Home"))]
   [:div {:id "next"} (if-let [next (:next link-data)]
                        (link-to (:next-url link-data) (str "Next Lab: " next))
                        (link-to "/" "Home"))]])

(defn lab [title link-data & body]
  {:pre [(string? (last title))]}
  (html
    [:head
     [:title (last title)]
     (apply include-css default-stylesheets)
     (apply include-js default-javascripts)]
    [:body [:div {:id "header"} title]
     [:div {:id "content"}
      (navigation link-data)
      body]
     [:div {:id "footer"} "Clojure labrepl. Copyright Relevance Inc. All Rights Reserved."]]))
Something went wrong with that request. Please try again.