Commits

Miki Tebeka  committed ddad59b

User name, remove eval and title tweak

  • Participants
  • Parent commits ae228f6

Comments (0)

Files changed (1)

File src/biggieurl.clj

    (user-id) ; We call it user-id to match Google user object
    (hits))) 
 
-(def *title* "BiggieURL - The not-so-small URL Shortener")
+(def *title* "BiggieURL: The not-so-small URL Shortener")
 
 (defn header-link []
   (if (nil? (current-user))
     [:a {:href (login-url "/")} "Login"]
     [:a {:href (logout-url "/")} "Logout"]))
 
+(defn user-name []
+  (let [user (current-user)]
+    (if (nil? user)
+      "Someone"
+      (:nickname user))))
+
 (def *jquery-url* 
   "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js")
 
      (include-js "/static/site.js")
      [:title *title*]]
     [:body 
-     [:div {:class "header"} (header-link)]
+     [:div {:class "header"} "Hello " (user-name) " [" (header-link) "]"]
      [:h1 *title*]
      content]))
 
-(defn eval-page [expr]
-  (page
-    (str (load-string (str "(in-ns 'biggieurl)" expr)))
-    (form-to [:post]
-      [:br]
-      [:input {:type "text" :name "expr" :value expr :size "100"}]
-      (submit-button "Eval"))))
-
 ; FIXME
 (defn long-url [url])
 (defn shorten-url [url])
   (GET "/" [] (home-page))
   (POST "/shorten" {params :params} (shorten-url params))
   (GET "/:url" [url] (or (long-url url) :next))
-
-; Uncomment these when debugging, *don't* let them slip to production           
-;  (GET "/_eval" [] (eval-page "0"))
-;  (POST "/_eval" {params :params} (eval-page (params "expr")))
-
   (route/not-found "Sorry, can't find it."))
 
 (defservice biggieurl-routes)