          (user-links)]
         ]]]]
     [:div#main-wrapper
-     [:div#main.container content]]))
+     [:div#main.container
+      (when-let [{:keys [type message]} (flash/get)]
+        (let [type (name type)]
+          [:div {:id "flash" :class (str "alert alert-" type)}
+           [:a.close {:data-dismiss "alert"} "x"]
+           [:strong (string/capitalize type) ": "] message]))
+      content]]))
 
 (defpartial control-group [params]
-  (let [name (string/lower-case (:name params))]
+  (let [name (string/replace (string/lower-case (:name params)) #"\s" "-")]
     [:div.control-group
      [:label.control-label {:for name} (str (:name params) ": ")]
      [:div.controls


(defpartial user-links []
  [:li.dropdown
   [:a.dropdown-toggle
    {:data-toggle "dropdown"}
    [:i.icon-user.icon-white] " User " [:b.caret]]
   [:ul.dropdown-menu
    [:li [:a {:href "/signup"} [:i.icon-check] " Sign Up"]]
    [:li [:a {:href "/login"} [:i.icon-share] " Log In"]]]])

(defpartial layout [& content]
  (base-layout

(ns cadence.views.common
  (:require [clojure.string :as string]
            [cemerick.friend :as friend]
            [cadence.model :as m]
            [cadence.model.flash :as flash])
  (:use noir.core
        hiccup.core
        hiccup.page-helpers))
