     (if-not active?
       " not-active-a8d35")))
 
-(sablono/defhtml build-option [idx bld prj-key]
+(sablono/defhtml build-option [bld prj-key]
   [:div.bld-e7c4d
-    {:on-click #(toggle-build-active prj-key idx)}
+    {:on-click #(toggle-build-active prj-key (:id bld))}
     (if (:active? bld)
       [:i.fa.fa-check-square-o]
       [:i.fa.fa-square-o])

        (js-log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"))

      (when @first-output?
        (show-waiting! prj-key bld-ids)
        (reset! first-output? false))

      (case type

;; NOTE: this function will not work if two builds have the same output-to target
;; should probably refactor with a filter?
(defn- output-to->bld-id [prj-key output-to]
  (let [blds (vals (get-in @state [:projects prj-key :builds]))
        outputs (map #(-> % :compiler :output-to) blds)
        ids (map :id blds)
        m (zipmap outputs ids)]
    (get m output-to)))

(defn- num-selected-builds [prj]
  (->> prj
    :builds
    vals
    (map :active?)
    (remove false?)
    count))
