 
 ;;;; Interaction with integrated references
 (defn click-reference
-  "When clicking on a reference directly in the text, make AJAX request with the url to the discussion
-   and show the sidebar to start the discussion."
+  "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))))
 

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

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

(defn query-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)]
