This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Update to modern versions of hiccup etc.

  • Loading branch information...
technomancy committed Feb 24, 2013
1 parent 02a4c0c commit 2e83471054fc511a53b54e0936272f4fa48cc5b7
Showing with 21 additions and 12 deletions.
  1. +2 −3 .gitignore
  2. +1 −1 README.md
  3. +6 −6 project.clj
  4. +2 −2 src/lein_survey/render.clj
  5. +10 −0 src/lein_survey/web.clj
View
@@ -1,7 +1,6 @@
pom.xml
-*jar
-/classes/
/.lein-deps-sum
/.lein-failures
/checkouts
-/.env
+/.env
+/target
View
@@ -10,6 +10,6 @@ To start a web server
## License
-Copyright © 2012 Phil Hagelberg
+Copyright © 2012-2013 Phil Hagelberg
Distributed under the Eclipse Public License, the same as Clojure.
View
@@ -1,8 +1,8 @@
(defproject lein-survey "1.0.0-SNAPSHOT"
:description "Survey for Leiningen users"
- :dependencies [[clojure "1.3.0"]
- [incanter/incanter-charts "1.2.4"]
- [org.clojure/java.jdbc "0.1.1"]
- [postgresql "8.4-702.jdbc4"]
- [hiccup "0.3.8"]
- [ring/ring-jetty-adapter "0.3.9"]])
+ :dependencies [[org.clojure/clojure "1.4.0"]
+ [incanter/incanter-charts "1.4.1"]
+ [org.clojure/java.jdbc "0.2.1"]
+ [postgresql "9.1-901-1.jdbc4"]
+ [hiccup "1.0.2"]
+ [ring/ring-jetty-adapter "1.1.6"]])
@@ -1,6 +1,6 @@
(ns lein-survey.render
- (:use [hiccup.page-helpers :only [html5 doctype include-css]]
- [hiccup.form-helpers :only [form-to label text-field submit-button]]))
+ (:use [hiccup.page :only [html5 doctype include-css]]
+ [hiccup.form :only [form-to label text-field submit-button]]))
(def input nil) ; dang it defonce semantics!
(defmulti input second)
View
@@ -16,6 +16,12 @@
[:timestamp :timestamp "NOT NULL"
"DEFAULT CURRENT_TIMESTAMP"])))
+(defn add-column []
+ (sql/with-connection (or (System/getenv "DATABASE_URL")
+ "postgres://localhost:5432/lein-survey")
+ (sql/do-commands "ALTER TABLE answers ADD COLUMN edition INTEGER")
+ (sql/do-commands "UPDATE answers SET edition = 2012")))
+
(defn record [params]
(sql/with-connection (or (System/getenv "DATABASE_URL")
"postgres://localhost:5432/lein-survey")
@@ -35,6 +41,10 @@
{:status 200
:headers {"Content-type" "application/x-clojure"}
:body (results/results-str)}
+ (= "/results/2012" (:uri req))
+ {:status 200
+ :headers {"Content-type" "text/html"}
+ :body (render/layout (results/summary))}
(= "/results" (:uri req))
{:status 200
:headers {"Content-type" "text/html"}

0 comments on commit 2e83471

Please sign in to comment.