Skip to content

Instantly share code, notes, and snippets.

@bttf bttf/application.clj Secret
Created Apr 28, 2013

Embed
What would you like to do?
1 (ns archibald-two.application
2 (:use [hiccup.core]
3 [hiccup.page])
4 (:require [archibald-two.db]))
5
6 (def page-title
7 "archibald speaks")
8
9 (defn content-box
10 [content]
11 [:div {:class "content-box"}
12 content])
13
14 (def all-updates
15 (for [x '(archibald-two.db/all-posts)]
16 (-> [:span (:title x)]
17 (content-box))))
18
19 (defn main-template
20 [body]
21 (html5
22 [:head
23 [:title page-title]
24 [:link {:rel "stylesheet" :href "/css/application.css"}]]
25 [:body
26 [:div {:class "container"}
27 [:div {:class "heading"}
28 [:h1 "archibald speaks"]]
29 [:div {:class "nav-bar"}
30 [:a {:href "/"} "home"]
31 [:a {:href "/posts"} "posts"]
32 [:a {:href "/about"} "about"]
33 [:a {:href "/contact"} "contact"]]
34 [:div {:class "body-div"}
35 body]]]))
36
37 (defn index
38 []
39 (-> all-updates
40 (main-template)))
41
42 (defn posts
43 []
44 (-> "Post after post after post, RIGHT HERE , NOT RIGHT NOW."
45 (content-box)
46 (main-template)))
1 (ns archibald-two.db
2 (:use [korma.db]
3 [korma.core]))
4
5 (defdb db (postgres {:db "archibald"
6 :user "archibald"
7 :password "******"})) ; should probably refer to env var here
8
9 (defentity posts)
10
11 (defn all-posts
12 []
13 (select posts))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.