|
|
@ -7,7 +7,8 @@
|
|
7
|
7
|
(:use ring.middleware.reload)
|
|
8
|
8
|
(:use ring.middleware.stacktrace)
|
|
9
|
9
|
(:use [ring.middleware.format-response :only [wrap-restful-response]])
|
|
10
|
|
(:use [ring.middleware.format-params :only [wrap-restful-params]]))
|
|
|
10
|
(:use [ring.middleware.format-params :only [wrap-restful-params]])
|
|
|
11
|
(:use hiccup.core))
|
|
11
|
12
|
|
|
12
|
13
|
|
|
13
|
14
|
; roadmap:
|
|
|
@ -93,7 +94,7 @@
|
|
93
|
94
|
%1)
|
|
94
|
95
|
{} map))
|
|
95
|
96
|
|
|
96
|
|
(defroutes shame-routes
|
|
|
97
|
(defroutes shame-api
|
|
97
|
98
|
(GET "/" [] (response @*shaming*))
|
|
98
|
99
|
(POST "/" [item] (dosync (ref-set *shaming*
|
|
99
|
100
|
(add-item item @*shaming*))))
|
|
|
@ -113,6 +114,35 @@
|
|
113
|
114
|
(close-item item-name (or status "failed") @*shaming*))))
|
|
114
|
115
|
(route/not-found "404 - Alternate Reality Monsters"))
|
|
115
|
116
|
|
|
|
117
|
(defn render-item [item]
|
|
|
118
|
[:div.shame.current
|
|
|
119
|
[:h2 (:name item)]
|
|
|
120
|
(when (count (:notes item))
|
|
|
121
|
[:ul (for [note (:notes item)]
|
|
|
122
|
[:li (if (string? note)
|
|
|
123
|
note
|
|
|
124
|
(:content note))])])])
|
|
|
125
|
|
|
|
126
|
(defn shame-index []
|
|
|
127
|
(html
|
|
|
128
|
(let [title (str "shame on me, I'm " (count (:current @*shaming*)) " things behind!")]
|
|
|
129
|
[:html
|
|
|
130
|
[:head
|
|
|
131
|
[:title title]
|
|
|
132
|
[:style {:rel "stylesheet", :href "todo.css"}]]
|
|
|
133
|
[:body
|
|
|
134
|
[:h1 title]
|
|
|
135
|
(for [item (:current @*shaming*)]
|
|
|
136
|
(render-item item))]])))
|
|
|
137
|
|
|
|
138
|
(defroutes shame-routes
|
|
|
139
|
(context "/todos" [] shame-api)
|
|
|
140
|
(GET "/" []
|
|
|
141
|
(content-type
|
|
|
142
|
(response (shame-index))
|
|
|
143
|
"text/html"))
|
|
|
144
|
(route/not-found "404 - Alternate Reality Monsters (in App)"))
|
|
|
145
|
|
|
116
|
146
|
(def serve
|
|
117
|
147
|
(-> (handler/site shame-routes)
|
|
118
|
148
|
(wrap-reload {:dirs ["."]})
|