   (reify om/IRender
     (render [_]
       (dom/div #js {:className "text-center"}
-               (dom/button #js {:className "btn btn-primary"}
+               (dom/button #js {:className "btn btn-primary"
+                                :onClick   #(query-reference-details 4)}
                            "Find usages of this reference")
                " "
                (dom/button #js {:className "btn btn-primary"}

  [response]
  (let [res (com/success-handler response)]))

(defn get-reference-details
  "Show usages of the provided reference."
  [reference-id]
  (let [url (str (:base config/api) (get-in config/api [:get :reference-usages]) "/" reference-id)]


;;;; Interaction with integrated references
(defn click-reference
  "When clicking on a reference directly in the text, interact with the user to give her the choice of what
   her next steps might be."
  [ref]
  #_(com/ajax-get url)
  (lib/change-view! :reference-dialog)
  (lib/save-selected-reference! ref)
  (println (lib/selected-reference))
  (sidebar/show)
  (lib/update-state-item! :layout :reference (fn [_] (:text ref))))

