--- a/resources/public/css/style.less Mon Oct 03 20:00:02 2011 -0400
+++ b/resources/public/css/style.less Mon Oct 03 20:15:07 2011 -0400
@@ -104,6 +104,7 @@
}
li.show {
margin-top: 12px;
+ margin-bottom: 20px;
img {
float: left;
@@ -113,4 +114,24 @@
width: 100px;
height: 100px;
}
+ .latest {
+ margin-top: -6px;
+ margin-bottom: 0px;
+ line-height: 1.25;
+ }
}
+
+// Pages
+.user {
+ li.show {
+ img {
+ width: 60px;
+ height: 60px;
+ }
+ form {
+ margin-top: 17px;
+ margin-bottom: 0;
+ float: right;
+ }
+ }
+}
--- a/src/newseasons/models/users.clj Mon Oct 03 20:00:02 2011 -0400
+++ b/src/newseasons/models/users.clj Mon Oct 03 20:15:07 2011 -0400
@@ -1,5 +1,6 @@
(ns newseasons.models.users
(:use newseasons.models.keys)
+ (:use newseasons.utils)
(:use [newseasons.models.shows :only (show-get)])
(:require [noir.util.crypt :as crypt])
(:use [aleph.redis :only (redis-client)]))
@@ -26,7 +27,9 @@
(let [user (apply hash-map @(r [:hgetall (key-user email)]))]
(when (not (empty? user))
(merge {:email (user "email") :pass (user "pass")}
- {:shows (map show-get @(r [:smembers (key-user-shows email)]))}))))
+ {:shows (sort-maps-by (map show-get
+ @(r [:smembers (key-user-shows email)]))
+ :title)}))))
(defn user-set-email! [email new-email]
@(r [:hset (key-user email) "email" new-email]))
--- a/src/newseasons/templates/main.clj Mon Oct 03 20:00:02 2011 -0400
+++ b/src/newseasons/templates/main.clj Mon Oct 03 20:15:07 2011 -0400
@@ -22,7 +22,7 @@
; Layout ----------------------------------------------------------------------
-(defpartial base [& content]
+(defpartial base [body-class & content]
(html5
[:head
(map include-css ["/css/base.css"
@@ -31,7 +31,7 @@
(include-less "/css/style.less")
(include-js "/js/less.js")
[:title "New Seasons"]]
- [:body
+ [:body {:class body-class}
[:div.container.clearfix
[:header.sixteen.columns [:h1 (link-to "/" "New Seasons")]]
(when-let [message (sess/flash-get)]
@@ -46,8 +46,8 @@
(link-to "http://webnoir.org/" "Noir")
"."]]]]))
-(defpartial inner [title & content]
- (base
+(defpartial inner [title body-class & content]
+ (base body-class
[:h2.sixteen.columns.page-title
[:div.profile
(form-to [:post "/logout"]
@@ -60,7 +60,7 @@
; Pages -----------------------------------------------------------------------
(defpartial home []
- (base
+ (base "home"
[:div.six.columns
[:form {:action "" :method "POST"}
(field text-field "email" "Email Address")
@@ -76,22 +76,22 @@
(defpartial user-show [show]
[:li.show.group
- [:img {:src (show :image)}]
- [:h3 (link-to (show :url) (show :title))]
- [:p.latest "Latest season: " (show :latest)]
(form-to [:post "/rem"]
[:input {:type "hidden" :name "artist-id" :value (show :id)}]
- (submit-button "Remove"))])
+ (submit-button "Remove"))
+ [:img {:src (show :image)}]
+ [:h3 (link-to (show :url) (show :title))]
+ [:p.latest "Latest: " (show :latest)]])
(defpartial user [user]
- (inner (str "Hello, " (:email user))
- [:div.eight.columns
+ (inner (str "Hello, " (:email user)) "user"
+ [:div.seven.columns
[:form {:action "/search"}
(field text-field
"query"
"Which show do you want to keep track of?")
(submit-button "Search")]]
- [:div.eight.columns
+ [:div.nine.columns
(let [shows (:shows user)]
(if (empty? shows)
[:p "You're not currently watching any shows."]
@@ -109,19 +109,19 @@
[:li.show.group
[:img {:src (r "artworkUrl100")}]
[:h3 (link-to (r "artistViewUrl") (r "artistName"))]
- [:p.latest "Latest season: " (r "collectionName")]
+ [:p.latest "Latest: " (r "collectionName")]
(form-to [:post "/add"]
[:input {:type "hidden" :name "artist-id" :value (r "artistId")}]
(submit-button "Add Show to List"))])
(defpartial search [query results]
- (inner (str "Search results for “" query "”")
+ (inner (str "Search results for “" query "”") "search"
[:ul.sixteen.columns.search-results
(map result results)]))
(defpartial password []
- (inner "Change Your Password"
+ (inner "Change Your Password" "change-password"
[:section.sixteen.columns
(form-to [:post ""]
(field password-field "password" "New Password")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/newseasons/utils.clj Mon Oct 03 20:15:07 2011 -0400
@@ -0,0 +1,6 @@
+(ns newseasons.utils)
+
+
+(defn sort-maps-by [coll k]
+ (sort #(compare (%1 k) (%2 k)) coll))
+
--- a/src/newseasons/views/main.clj Mon Oct 03 20:00:02 2011 -0400
+++ b/src/newseasons/views/main.clj Mon Oct 03 20:15:07 2011 -0400
@@ -1,5 +1,6 @@
(ns newseasons.views.main
(:use noir.core)
+ (:use newseasons.utils)
(:require [noir.response :as resp])
(:require [noir.session :as sess])
(:require [noir.util.crypt :as crypt])
@@ -46,10 +47,6 @@
(defn unique-shows [seasons]
(unique-by (sort-maps-by seasons "releaseDate") "artistId"))
-(defn sort-maps-by [coll k]
- (sort #(compare (%1 k) (%2 k)) coll))
-
-
; iTunes ----------------------------------------------------------------------
(defn itunes-search [params]
((parse-string (:body (client/get "http://itunes.apple.com/search"