             [cadence.model :as m]
             [noir.validation :as vali]
             [cadence.model.flash :as flash])
-  (:use noir.core
-        hiccup.core
-        hiccup.page-helpers))
+  (:use (hiccup core def page)))
 
 (def ^:dynamic *javascripts* ["/js/bootstrap.min.js"])
 

(defn- as-css-id [s]
  (name (if (nil? s) "" s)))

(defpartial form-button [{:keys [eclass value]}]
  [(keyword (str "button.btn" (as-css-id eclass)))
   {:type "submit"} value])

(defpartial control-group-form [id+class params items buttons]
  [(keyword (str "form" (as-css-id id+class))) params
   [:fieldset
    (map control-group items)
    [:div.form-actions
     (map form-button buttons)]]])

(defpartial input [{:keys [eclass type name placeholder params]}]
  [(keyword (str "input" (as-css-id eclass)))
   (merge params {:type type
                  :name (string/lower-case name)
                  :placeholder (or placeholder name)})])

(defpartial default-form [id+class params items buttons]
  [(keyword (str "form" (as-css-id id+class))) params
   (interpose " " (map input items)) " "
   (map form-button buttons)])

(defpartial phrase-fields [id phrase]
  [:div.row-fluid
   [:div#given-phrase.input-xlarge.uneditable-input.span12
    phrase]]

  `(binding [*javascripts* ~js-paths]
     ~@body))

(defn base-layout [& content]
  (html5
    [:head
     [:title "Cadence"]
