9a3a49acb6e0

Check searches.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 05 Oct 2011 21:54:22 -0400
parents 9275d33bd224
children a7d0d997f520
branches/tags (none)
files src/newseasons/views/main.clj

Changes

--- a/src/newseasons/views/main.clj	Wed Oct 05 21:50:06 2011 -0400
+++ b/src/newseasons/views/main.clj	Wed Oct 05 21:54:22 2011 -0400
@@ -100,9 +100,12 @@
 ; 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))))
+    (if (empty? query)
+      (do (flash! "Please enter something to search for.")
+        (resp/redirect "/")) 
+      (let [results (unique-shows (itunes-search-show query))]
+        (shows/store-raw-shows results)
+        (t/search query results)))))
 
 
 ; Add -------------------------------------------------------------------------