Skip to content
This repository has been archived by the owner on Jan 23, 2018. It is now read-only.

Commit

Permalink
Update to modern versions of hiccup etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Feb 24, 2013
1 parent 02a4c0c commit 2e83471
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
5 changes: 2 additions & 3 deletions .gitignore
@@ -1,7 +1,6 @@
pom.xml pom.xml
*jar
/classes/
/.lein-deps-sum /.lein-deps-sum
/.lein-failures /.lein-failures
/checkouts /checkouts
/.env /.env
/target
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -10,6 +10,6 @@ To start a web server


## License ## License


Copyright © 2012 Phil Hagelberg Copyright © 2012-2013 Phil Hagelberg


Distributed under the Eclipse Public License, the same as Clojure. Distributed under the Eclipse Public License, the same as Clojure.
12 changes: 6 additions & 6 deletions project.clj
@@ -1,8 +1,8 @@
(defproject lein-survey "1.0.0-SNAPSHOT" (defproject lein-survey "1.0.0-SNAPSHOT"
:description "Survey for Leiningen users" :description "Survey for Leiningen users"
:dependencies [[clojure "1.3.0"] :dependencies [[org.clojure/clojure "1.4.0"]
[incanter/incanter-charts "1.2.4"] [incanter/incanter-charts "1.4.1"]
[org.clojure/java.jdbc "0.1.1"] [org.clojure/java.jdbc "0.2.1"]
[postgresql "8.4-702.jdbc4"] [postgresql "9.1-901-1.jdbc4"]
[hiccup "0.3.8"] [hiccup "1.0.2"]
[ring/ring-jetty-adapter "0.3.9"]]) [ring/ring-jetty-adapter "1.1.6"]])
4 changes: 2 additions & 2 deletions src/lein_survey/render.clj
@@ -1,6 +1,6 @@
(ns lein-survey.render (ns lein-survey.render
(:use [hiccup.page-helpers :only [html5 doctype include-css]] (:use [hiccup.page :only [html5 doctype include-css]]
[hiccup.form-helpers :only [form-to label text-field submit-button]])) [hiccup.form :only [form-to label text-field submit-button]]))


(def input nil) ; dang it defonce semantics! (def input nil) ; dang it defonce semantics!
(defmulti input second) (defmulti input second)
Expand Down
10 changes: 10 additions & 0 deletions src/lein_survey/web.clj
Expand Up @@ -16,6 +16,12 @@
[:timestamp :timestamp "NOT NULL" [:timestamp :timestamp "NOT NULL"
"DEFAULT CURRENT_TIMESTAMP"]))) "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] (defn record [params]
(sql/with-connection (or (System/getenv "DATABASE_URL") (sql/with-connection (or (System/getenv "DATABASE_URL")
"postgres://localhost:5432/lein-survey") "postgres://localhost:5432/lein-survey")
Expand All @@ -35,6 +41,10 @@
{:status 200 {:status 200
:headers {"Content-type" "application/x-clojure"} :headers {"Content-type" "application/x-clojure"}
:body (results/results-str)} :body (results/results-str)}
(= "/results/2012" (:uri req))
{:status 200
:headers {"Content-type" "text/html"}
:body (render/layout (results/summary))}
(= "/results" (:uri req)) (= "/results" (:uri req))
{:status 200 {:status 200
:headers {"Content-type" "text/html"} :headers {"Content-type" "text/html"}
Expand Down

0 comments on commit 2e83471

Please sign in to comment.