   "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."
   [reference]
-  #_(com/ajax-get (:url reference))
   (lib/change-view! :reference-dialog)
   (lib/save-selected-reference! reference)
   (sidebar/show)

               (dom/button #js {:className "btn btn-primary"}
                           "Create new Statement with this reference")))))

(defn usages-view
  "List with details showing the usages of the given reference."
  []
  (reify om/IRender
    (render [_]
      (dom/h4 nil "foo"))))
            [discuss.sidebar :as sidebar]
            [discuss.utils.common :as lib]))

(defn- get-reference-usages-from-app-state
  "Return list of reference usages, which were previously stored in the app-state.
   TODO: optimize"
  []
  (get-in @lib/app-state [:common :reference-usages]))

(defn reference-usage-handler
  "Handler to process information about the reference. Store results and change view."
  [response]
  (let [res (com/success-handler response)]
    (lib/update-state-item! :common :reference-usages (fn [_] res))
    (lib/change-view! :reference-usages)))

(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)]
    (com/ajax-get url {} reference-usage-handler)))


