Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix ranking alignment.

  • Loading branch information...
commit 1abc512a7cb92f08847a0bedf13c399fd8e394ff 1 parent 0e21144
@technomancy authored
View
27 resources/public/lein-survey.css
@@ -2,7 +2,7 @@ html, body {
background-color: #eee;
}
body {
- padding-top: 40px;
+ padding-top: 20px;
}
.content {
background-color: #fff;
@@ -18,6 +18,27 @@ body {
padding: 20px;
}
-.float {
- float: left;
+li.ranking {
+ clear: both;
+ color: black;
+ list-style-type: none;
+}
+
+.rank li {
+ padding: 1em;
+ display: inline;
+ list-style-type: none;
+}
+
+.rank label {
+ width: 3em;
+}
+
+.rank span {
+ padding-left: 0.5em;
+}
+
+p.question {
+ margin-top: 1em;
+ font-weight: bold;
}
View
31 src/lein_survey/questions.clj
@@ -1,17 +1,6 @@
(ns lein-survey.questions)
-(def questions [["When did you start using Leiningen?" :radio
- ["0.5 (Nov 2009)"
- "1.0 (Dec 2009)"
- "1.1 (Feb 2010)"
- "1.2 (Jul 2010)"
- "1.3 (Aug 2010)"
- "1.4 (Dec 2010)"
- "1.5 (Mar 2011)"
- "1.6 (Jun 2011)"
- "2.0.0-SNAPSHOT"
- "I don't remember"]]
- ["How long have you been using Clojure?" :radio
+(def questions [["How long have you been using Clojure?" :radio
["Just started" "Weeks" "Months" "1 year" "2 years" "3+ years"]]
["For what do you use Leiningen? (pick as many as apply)" :check
["Open source" "Proprietary projects"
@@ -20,6 +9,17 @@
["Do you deploy jars?" :check
["to Clojars" "to other public repositories"
"to private repositories"]]
+ ["When did you start using Leiningen?" :radio
+ ["I don't remember"
+ "0.5 (Nov 2009)"
+ "1.0 (Dec 2009)"
+ "1.1 (Feb 2010)"
+ "1.2 (Jul 2010)"
+ "1.3 (Aug 2010)"
+ "1.4 (Dec 2010)"
+ "1.5 (Mar 2011)"
+ "1.6 (Jun 2011)"
+ "2.0.0-SNAPSHOT"]]
["Your OS and package manager" :check
["Debian/Ubuntu"
"Fedora/other RPM-based"
@@ -39,14 +39,13 @@
["Downloading bin/lein"
"Package manager"
"Git"]]
- [(str "Paste your stats for: history | grep \"lein \" | "
+ [(str "Paste your results: history | grep \"lein \" | "
"awk '{print $3}' | sort | uniq -c | sort -nr | "
"egrep -v \"^ +1\"") :textarea]
["Which Leiningen features do you use?" :check
["Auto-cleaning of transitively-compiled .class files"
"Checkout dependencies"
"clean task"
- "Custom options to :repositories"
"Editor integration"
"interactive task"
"javac task"
@@ -57,8 +56,8 @@
"Shell wrappers"
"Test selectors"
"trampoline task"]]
- ["Favourite plugins?" :textarea]
- ["Biggest problem/annoyance?" :rank
+ ["Favourite plugins?" :textarea 2]
+ ["Rank your biggest annoyances:" :rank
["Startup time"
"Difficulty finding dependencies"
"Not enough plugins"
View
21 src/lein_survey/render.clj
@@ -7,7 +7,7 @@
(defmethod input :radio [[question _ answers]]
[:div
- [:p question]
+ [:p.question question]
[:ul.inputs-list
(for [a answers]
[:li [:label [:input {:type "radio" :name question :value a}]
@@ -15,7 +15,7 @@
(defmethod input :check [[question _ answers]]
[:div
- [:p question]
+ [:p.question question]
[:ul.inputs-list
(for [a answers]
[:li [:label [:input {:type "checkbox" :name question :value a}]
@@ -23,18 +23,19 @@
(defmethod input :rank [[question _ answers]]
[:div
- [:p question]
- [:ul.inputs-list
+ [:p.question question]
+ [:ul
(for [a answers]
- [:li [:span a]
- [:ul.inputs-list
+ [:li.ranking [:span a]
+ [:ul.rank
(for [n (reverse (range (count answers)))]
- [:li.float [:label [:input {:type "radio" :name (str question "-" a)
- :value n}]
- [:span n]]])]])]])
+ [:li [:label [:input {:type "radio"
+ :name (str question "-" a) :value n}]
+ [:span n]]])]])]])
(defmethod input :textarea [[question _ rows]]
- [:div [:p question] [:textarea.xxlarge {:rows (or rows 5) :name question}]])
+ [:div [:p.question question]
+ [:textarea.xxlarge {:rows (or rows 5) :name question}]])
(defn questions-form [questions]
[:form {:method "POST" :action "/"}
View
6 src/lein_survey/web.clj
@@ -1,19 +1,17 @@
(ns lein-survey.web
(:require [lein-survey.render :as render]
[lein-survey.questions :as q]
- [compojure.core :as compojure]
[ring.adapter.jetty :as jetty]
[clojure.java.jdbc :as sql]
[ring.middleware.params :as params]
- [ring.middleware.resource :as resource]
- [compojure.route :as route]))
+ [ring.middleware.resource :as resource]))
(defn create-table []
(sql/with-connection (or (System/getenv "DATABASE_URL")
"postgres://localhost:5432/lein-survey")
(sql/create-table :answers
[:id :serial "PRIMARY KEY"]
- [:body :varchar "NOT NULL"]
+ [:body :text "NOT NULL"]
[:timestamp :timestamp "NOT NULL"
"DEFAULT CURRENT_TIMESTAMP"])))
Please sign in to comment.
Something went wrong with that request. Please try again.