       (let [{:keys [cast! issue-db cust]} (om/get-shared owner)]
         (html
          [:div.menu-view.issues-list
-           (let [deleted (set/difference rendered-issue-ids all-issue-ids)
-                 added (set/difference all-issue-ids rendered-issue-ids)]
-             (when (or (seq deleted) (seq added))
-                [:a {:role "button"
-                     :on-click #(om/update-state! owner (fn [s]
-                                                          (assoc s
-                                                                 :rendered-issue-ids (:all-issue-ids s)
-                                                                 :render-time (datetime/server-date))))}
-                 (cond (empty? deleted)
-                       (str (count added) (if (< 1 (count added))
-                                            " new issues were"
-                                            " new issue was")
-                            " added, click to refresh.")
-                       (empty? added)
-                       (str (count deleted) (if (< 1 (count deleted))
-                                              " issues were"
-                                              " issue was")
-                            " removed, click to refresh.")
-                       :else
-                       (str (count added) (if (< 1 (count added))
-                                            " new issues were"
-                                            " new issue was")
-                            " added, " (count deleted) " removed, click to refresh."))]))
-           ; [:div.make {:key "issue-form"}
-           ;  (om/build issue-form {})]
-           ; [:div.content.make
-           ; (om/build issue-form {})]
-
-           (om/build issue-form {})
-
-           ; :div.make {:key "summary"}
-            (when-let [issues (seq (map #(d/entity @issue-db %) rendered-issue-ids))]
-              (om/build-all issue-card (map (fn [i] {:issue-id (:db/id i)})
-                                               (sort (issue-model/issue-comparator cust render-time) issues))
-                            {:key :issue-id
-                             :opts {:issue-db issue-db}}))])))))
+          (let [deleted (set/difference rendered-issue-ids all-issue-ids)
+                added (set/difference all-issue-ids rendered-issue-ids)]
+            (when (or (seq deleted) (seq added))
+              [:a {:role "button"
+                   :on-click #(om/update-state! owner (fn [s]
+                                                        (assoc s
+                                                          :rendered-issue-ids (:all-issue-ids s)
+                                                          :render-time (datetime/server-date))))}
+               (cond (empty? deleted)
+                     (str (count added) (if (< 1 (count added))
+                                          " new issues were"
+                                          " new issue was")
+                          " added, click to refresh.")
+                     (empty? added)
+                     (str (count deleted) (if (< 1 (count deleted))
+                                            " issues were"
+                                            " issue was")
+                          " removed, click to refresh.")
+                     :else
+                     (str (count added) (if (< 1 (count added))
+                                          " new issues were"
+                                          " new issue was")
+                          " added, " (count deleted) " removed, click to refresh."))]))
+          (om/build issue-form {})
+          (when-let [issues (seq (map #(d/entity @issue-db %) rendered-issue-ids))]
+            (om/build-all issue-card (map (fn [i] {:issue-id (:db/id i)})
+                                          (sort (issue-model/issue-comparator cust render-time) issues))
+                          {:key :issue-id
+                           :opts {:issue-db issue-db}}))])))))
 
 (defn issue [{:keys [issue-uuid]} owner]
   (reify

      (let [{:keys [cast! issue-db]} (om/get-shared owner)
            issue (ds/touch+ (d/entity @issue-db issue-id))]
        (html
          [:div.menu-view.issue

           #_(when-not (keyword-identical? :none (:issue/document issue :none))
               [:a {:href (urls/absolute-doc-url (:issue/document issue) :subdomain nil)
                    :target "_blank"}
                [:img {:src (urls/absolute-doc-svg (:issue/document issue) :subdomain nil)}]])

           [:div.issue-summary
           (om/build issue-card {:issue-id issue-id})
           (om/build description-form {:issue issue :issue-id issue-id})]

           [:div.issue-comments
           (om/build comment-form {:issue-id issue-id})
           (om/build comments {:issue issue})]


           ; [:div.single-issue-head
           ;  ; (om/build vote-box {:issue issue})
           ;  ; [:h4 (or title (:issue/title issue ""))]
           ;  (om/build vote-box {:issue issue})
           ;  [:div.single-issue-info
           ;  [:h4 (or title (:issue/title issue ""))]

           ;  ; [:div.issue-tags
           ;  ;  [:div.issue-tag.issue-type "feature"]
           ;  ;  [:div.issue-tag.issue-status "started"]
           ;  ;  [:div.issue-tag.issue-author (:issue/author issue)]
           ;  ;  ]

           ;  ; [:div.comment-foot
           ;  ;  [:a.issue-tag.issue-type {:role "button"} "feature"]
           ;  ;  [:a.issue-tag.issue-status {:role "button"} "started"]
           ;  ;  [:a.issue-tag.issue-author {:role "button"} (:issue/author issue)]
           ;  ;  ]

           ;  (issue-tags issue)

           ;  ; [:div.comment-author
           ;  ;  [:span.comment-avatar (common/icon :user)]
           ;  ;  [:span.comment-name (str " " (:issue/author issue))]
           ;  ;  [:span.comment-datetime (str " " (datetime/month-day (:issue/created-at issue)))]]

           ;  ]]

           ; [:p "by: " (:issue/author issue)]

           ; [:p "Title "
           ;  [:input {:value (or title (:issue/title issue ""))
           ;           :on-change #(om/set-state! owner :title (.. % -target -value))}]]

           ; [:p "Description "
           ;  [:input {:value (or description (:issue/description issue ""))
           ;           :on-change #(om/set-state! owner :description (.. % -target -value))}]]

           ; [:input {:value (or description (:issue/description issue ""))
           ;          :on-change #(om/set-state! owner :description (.. % -target -value))}]

           ; (om/build description-form {:issue issue
           ;                             :issue-id issue-id})

           ; (om/build comment-form {:issue-id issue-id})

           ; [:div.comment-author
           ;  [:span.comment-avatar (common/icon :user)]
           ;  [:span.comment-name (str " " (:issue/author issue))]
           ;  [:span.comment-datetime (str " " (datetime/month-day (:issue/created-at issue)))]]

           ; [:div.comment-content
           ;  (or description (:issue/description issue ""))]

           ; [:div.single-issue-body

           ;  ; [:div.comment-author
           ;  ;  [:span.comment-avatar (common/icon :user)]
           ;  ;  [:span.comment-name (str " " (:issue/author issue))]
           ;  ;  [:span.comment-datetime (str " " (datetime/month-day (:issue/created-at issue)))]]

           ; (if description

           ;   [:div.comment-content
           ;    (or description (:issue/description issue ""))]

           ;   [:div.comment-content "There's no description yet."])]

           ; (when (:issue/description issue)
           ;   [:div.issue-description (:issue/description issue)]
           ;   )

           ; [:div.single-issue-foot
           ;   [:a {:role "button"} "reply"]
           ;  ]

           ; [:div.issue-tags
           ;  ; [:div.issue-tag.issue-type "feature"]
           ;  ; [:div.issue-tag.issue-status "started"]
           ;  [:div.issue-tag.issue-author (:issue/author issue)]]

           ; [:p
           ;  [:a {:role "button"
           ;       :on-click #(d/transact! issue-db [(utils/remove-map-nils
           ;                                          {:db/id issue-id
           ;                                           :issue/title title
           ;                                           :issue/description description})])}
           ;   "Save"]
           ;  " "
           ;  [:a {:on-click #(d/transact! issue-db [[:db.fn/retractEntity issue-id]])
           ;       :role "button"}
           ;   "Delete"]]

           ; [:div.issue-comment-input.adaptive-placeholder {:contentEditable true
           ;                                                 :data-before "What do you think about this issue?"
           ;                                                 :data-after "Hit enter to submit your comment"
           ;                                                 :data-forgot "You forgot to submit!"}]

           ; [:div.content
           ;  (om/build comment-form {:issue-id issue-id})]

           ; (om/build comment-form {:issue-id issue-id})

           ; [:div.calls-to-action
           ; [:a.menu-button {:role "button"} "Comment"]]

           ; [:h4 (str "0" " comments")]

           ; (om/build comment-form {:issue-id issue-id}) ; needed

           ; (om/build comments {:issue issue}) ; needed

           ; [:p "Make a new comment:"]

           ; (om/build comment-form {:issue-id issue-id})

           ])))))

(defn issue-list [_ owner]
  (reify

                      (om/set-state! owner :issue-description nil)
                      (om/set-state! owner :editing? false))]
        (html
         (if editing?
           [:div.content {:class (when-not (:issue/description issue) " make ")}
            [:form.adaptive {:on-submit submit}
             [:textarea.issue-description {:class (when (:issue/description issue) " to-edit ")
                                           :value (or issue-description (:issue/description issue ""))
                                           :required "true"
                                           :on-change #(om/set-state! owner :issue-description (.. % -target -value))
                                           :on-blur submit}]
             [:label {:data-label "Issue Description"
                      :data-placeholder "Want to elaborate on your idea?"}]
             [:p.issue-foot
              [:span (common/icon :user) " "]
              [:a {:role "button"} (:issue/author issue)]
              [:span " on "]
              [:a {:role "button"} (datetime/month-day (:issue/created-at issue))]
              [:span " — "]
              (when editable?
                [:a.issue-description-edit {:role "button"
                                            :key "Cancel"
                                            :on-click submit}
                 "Save"])]]]

           [:div.comment {:class (when-not (om/get-state owner :to-not-edit?) " make ")}
            [:p.issue-description {:class (when (om/get-state owner :to-not-edit?) " to-not-edit ")}
             (if (:issue/description issue)
               (:issue/description issue)

               (if editable?
                 [:a {:role "button"
                      :on-click #(do
                                   (om/set-state! owner :editing? true)
                                   (om/set-state! owner :to-not-edit? true))}
                  [:span (common/icon :plus)]
                  [:span " Add a description."]]

                 [:span "No description yet."]))]
            [:p.issue-foot
             [:span (common/icon :user) " "]
             [:a {:role "button"} (:issue/author issue)]
             [:span " on "]
             [:a {:role "button"} (datetime/month-day (:issue/created-at issue))]
             [:span " — "]
             (when editable?
               [:a.issue-description-edit {:role "button"
                                           :key "Edit"
                                           :on-click #(do
                                                        (om/set-state! owner :editing? true)
                                                        (om/set-state! owner :to-not-edit? true))}
                "Edit"])]]))))))

;; XXX: handle logged-out users
(defn vote-box [{:keys [issue]} owner]
