 
 
 ;;; PAGE
-
-(defonce user-doc
-  (atom {:person {:first-name       "Blake"
-                  :last-name        "Hake"
-                  :email            "blake@hake.fake.com"
-                  :age              :18-24
-                  :alert-ideas?     true
-                  :alert-volunteer? true
-                  :alert-districts? true}}))
 
 (defn page []
   (fn []

         [:a.btn.btn-xs.btn-default {:disabled true} (str "Add idea to " d)]
         [:br]]))]))

(defn add-idea-form []
  [:div
   (input "Idea title" :text :idea.idea)
   [select-cat-component]
   [:p
    [:textarea.form-control
     {:rows "4" :placeholder "If necessary, add a description"}]]
   (for [i (range 3)]
     [:div {:key i}
      (input-placeholder "Add a reference URL" :text (symbol (str "idea.url." i)))])])

(defn add-idea-component []
  [:div
   [:button.btn.btn-default
    {:on-click #(db/create-idea! {:title     "More pizza"
                                  :desc      "Food for me"
                                  :districts ["Brooklyn"]
                                  :category  "Green"
                                  :links     []})}
    "Add your idea"]])

(defn signature-component []

  "Ensure the signing user exists and their support is noted."
  [doc]
  (db/create-user! (:person doc) @db/supported-ideas))

(defn normalize-idea [idea]
  (-> idea
      (update :urls #(into [] (vals (apply sorted-set %))))
      ;; just add to all districts for now
      (assoc :districts @db/districts)))

(defn submit-idea!
  [doc]
  (prn doc)
  (db/create-idea! doc))

;; forms

(defonce user-doc
  (atom {:person {:first-name       "Blake"
                  :last-name        "Hake"
                  :email            "blake@hake.fake.com"
                  :age              :18-24
                  :alert-ideas?     true
                  :alert-volunteer? true
                  :alert-districts? true}}))

(defonce idea-doc
  (atom {:title     nil
         :desc      nil
         :districts nil
         :category  nil
         :links     nil}))

;;; view helpers

