--- a/resources/public/css/style.less Wed Oct 05 20:32:33 2011 -0400
+++ b/resources/public/css/style.less Wed Oct 05 21:50:06 2011 -0400
@@ -68,7 +68,6 @@
text-align: center;
border-top: 2px solid #ddd;
padding-top: 16px;
- margin-top: 32px;
font-style: italic;
font-size: 15px;
font-family: Palatino, Georgia, serif;
@@ -126,26 +125,35 @@
p.delete {
text-align: center;
color: #777;
- margin-bottom: -18px;
padding-top: 12px;
+ margin-bottom: 0;
+ padding-bottom: 12px;
border-top: 2px solid #ddd;
a {
color: #555;
+
+ &:hover {
+ color: #222;
+ }
}
}
// Pages
.user {
- li.show {
- img {
- width: 60px;
- height: 60px;
- }
- form {
- margin-top: 17px;
- margin-bottom: 0;
- float: right;
+ ul.shows {
+ margin-bottom: 32px;
+
+ li.show {
+ img {
+ width: 60px;
+ height: 60px;
+ }
+ form {
+ margin-top: 17px;
+ margin-bottom: 0;
+ float: right;
+ }
}
}
}
--- a/src/newseasons/loops/refresh.clj Wed Oct 05 20:32:33 2011 -0400
+++ b/src/newseasons/loops/refresh.clj Wed Oct 05 21:50:06 2011 -0400
@@ -1,4 +1,5 @@
(ns newseasons.loops.refresh
+ (:use [newseasons.settings :only (postmark-api-key)])
(:require [newseasons.models.shows :as shows])
(:require [newseasons.itunes :as itunes]))
@@ -45,6 +46,7 @@
(println "")
(println "Refreshing Shows")
(println "----------------")
+ (Thread/sleep 20000)
(let [shows (shows/shows-get-to-check)]
(dorun (map refresh-show shows))))
--- a/src/newseasons/models/shows.clj Wed Oct 05 20:32:33 2011 -0400
+++ b/src/newseasons/models/shows.clj Wed Oct 05 21:50:06 2011 -0400
@@ -1,9 +1,10 @@
(ns newseasons.models.shows
+ (:use newseasons.settings)
(:use newseasons.models.keys)
(:use [aleph.redis :only (redis-client)]))
-(def r (redis-client {:host "localhost" :password "devpass"}))
+(def r (redis-client {:host "localhost" :password redis-pass}))
; "Schema" --------------------------------------------------------------------
;
--- a/src/newseasons/models/users.clj Wed Oct 05 20:32:33 2011 -0400
+++ b/src/newseasons/models/users.clj Wed Oct 05 21:50:06 2011 -0400
@@ -1,4 +1,5 @@
(ns newseasons.models.users
+ (:use newseasons.settings)
(:use newseasons.models.keys)
(:use newseasons.utils)
(:use [newseasons.models.shows :only (show-get)])
@@ -6,7 +7,7 @@
(:use [aleph.redis :only (redis-client)]))
-(def r (redis-client {:host "localhost" :password "devpass"}))
+(def r (redis-client {:host "localhost" :password redis-pass}))
; "Schema" --------------------------------------------------------------------
;
--- a/src/newseasons/templates/main.clj Wed Oct 05 20:32:33 2011 -0400
+++ b/src/newseasons/templates/main.clj Wed Oct 05 21:50:06 2011 -0400
@@ -56,12 +56,13 @@
(submit-button "Change Password"))]
title]
content
+ (when-not (= body-class "user")
+ [:p.sixteen.columns (link-to "/" "← Back to Dashboard")])
[:p.delete.sixteen.columns
"Don't want to receive any more notifications? "
"You can "
(link-to "/delete-account" "delete your account")
- "."]
- ))
+ "."]))
; Pages -----------------------------------------------------------------------
@@ -108,7 +109,7 @@
" show"
(pluralize shows)
"."]
- [:ul (map user-show shows)])))]))
+ [:ul.shows (map user-show shows)])))]))
(defpartial result [r]
@@ -121,7 +122,12 @@
(submit-button "Add Show to List"))])
(defpartial search [query results]
- (inner (str "Search results for “" query "”") "search"
+ (inner (str (if (empty? results)
+ "No"
+ (count results))
+ " Result" (pluralize results)
+ " for “" query "”")
+ "search"
[:ul.sixteen.columns.search-results
(map result results)]))
--- a/src/newseasons/views/main.clj Wed Oct 05 20:32:33 2011 -0400
+++ b/src/newseasons/views/main.clj Wed Oct 05 21:50:06 2011 -0400
@@ -14,7 +14,7 @@
(def email-regex #"[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}")
(defn all-are [pred coll]
(= (count coll)
- (count (filter pred coll))))
+ (count (filter pred coll))))
(defn flash! [message]
(sess/flash-put! message)
@@ -28,16 +28,16 @@
Ex:
- (def a {:foo 1 :bar 1 :baz 1})
- (def b {:foo 1 :bar 1 :baz 2})
- (def c {:foo 1 :bar 2 :baz 3})
+ (def a {:foo 1 :bar 1 :baz 1})
+ (def b {:foo 1 :bar 1 :baz 2})
+ (def c {:foo 1 :bar 2 :baz 3})
- (unique-by [a b c] :foo)
- ;=> [c]
- (unique-by [a b c] :foo :bar)
- ;=> [b c]
- (unique-by [a b c] :baz)
- ;=> [a b c]
+ (unique-by [a b c] :foo)
+ ;=> [c]
+ (unique-by [a b c] :foo :bar)
+ ;=> [b c]
+ (unique-by [a b c] :baz)
+ ;=> [a b c]
"
[coll & ks]
(vals (reduce merge {} (map #(vector (select-keys % ks) %) coll))))
@@ -78,74 +78,76 @@
; Home ------------------------------------------------------------------------
(defpage [:get "/"] []
- (if-let [email (sess/get :email)]
- (resp/redirect (str "/" email))
- (t/home)))
+ (if-let [email (sess/get :email)]
+ (resp/redirect (str "/" email))
+ (t/home)))
(defpage [:post "/"] {:as login}
- (if (check-login login)
- (resp/redirect (str "/" (:email login)))
- (render "/" login)))
+ (if (check-login login)
+ (resp/redirect (str "/" (:email login)))
+ (render "/" login)))
; User ------------------------------------------------------------------------
(defpage [:get ["/:email" :email email-regex]] {:keys [email]}
- (login-required
- (if (not= email (sess/get :email))
- (force-login)
- (let [user (users/user-get email)]
- (t/user user)))))
+ (login-required
+ (if (not= email (sess/get :email))
+ (force-login)
+ (let [user (users/user-get email)]
+ (t/user user)))))
; Search ----------------------------------------------------------------------
(defpage [:get "/search"] {:keys [query]}
- (login-required
- (let [results (unique-shows (itunes-search-show query))]
- (shows/store-raw-shows results)
- (t/search query results))))
+ (login-required
+ (let [results (unique-shows (itunes-search-show query))]
+ (shows/store-raw-shows results)
+ (t/search query results))))
; Add -------------------------------------------------------------------------
(defpage [:post "/add"] {:keys [artist-id]}
- (login-required
- (users/user-add-show! (sess/get :email) artist-id)
- (shows/show-set-version-maybe! artist-id
- (:release-date (shows/show-get artist-id)))
- (shows/show-add-to-check! artist-id)
- (flash! "Added a show to your list.")
- (resp/redirect "/")))
+ (login-required
+ (users/user-add-show! (sess/get :email) artist-id)
+ (shows/show-add-to-check! artist-id)
+ (let [show (shows/show-get artist-id)]
+ (shows/show-set-version-maybe! artist-id
+ (:release-date show))
+ (flash! (str "Added “" (:title show) "” to your list. "
+ "We'll email you if a new season hits iTunes.")))
+ (resp/redirect "/")))
; Remove ----------------------------------------------------------------------
(defpage [:post "/rem"] {:keys [artist-id]}
- (login-required
- (users/user-rem-show! (sess/get :email) artist-id)
- (flash! "Removed a show from your list.")
- (resp/redirect "/")))
+ (login-required
+ (users/user-rem-show! (sess/get :email) artist-id)
+ (flash! "Removed a show from your list.")
+ (resp/redirect "/")))
; Change Password -------------------------------------------------------------
(defpage [:get "/password"] []
- (login-required
- (t/password)))
+ (login-required
+ (t/password)))
(defn- pass-valid? [password]
(not (empty? password)))
(defpage [:post "/password"] {:keys [password]}
- (login-required
- (if-not (pass-valid? password)
- (render "/password" password)
- (do
- (users/user-set-pass! (sess/get :email) password)
- (resp/redirect "/")))))
+ (login-required
+ (if-not (pass-valid? password)
+ (render "/password" password)
+ (do
+ (users/user-set-pass! (sess/get :email) password)
+ (resp/redirect "/")))))
; Log Out ---------------------------------------------------------------------
(defpage [:post "/logout"] []
- (sess/remove! :email)
- (resp/redirect "/"))
+ (sess/remove! :email)
+ (resp/redirect "/"))
; Delete Account --------------------------------------------------------------
@@ -157,5 +159,6 @@
(login-required
(users/user-delete! (sess/get :email))
(sess/remove! :email)
+ (flash! "Your account has been deleted. You can sign up again later if you want, though!")
(resp/redirect "/")))