 
 (defn completed? [req gotten]
   (>= gotten req))
+
+(defn init-user-badge [data-atom]
+  (ajax/GET
+    (path-for (str "/obpv1/badge/info/" (:id @data-atom)))
+    {:handler (fn [data]
+                (reset! data-atom data))}))
+
+(defn change-declined-badge-status [id]
+  (ajax/POST
+    (path-for (str "/obpv1/metabadge/update_status/" id))
+    {:handler (fn []
+                (mo/open-modal [:badge :info] {:badge-id id}))
+     :error-handler (fn [{:keys [status status-text]}])}))
 
 (defn dummy-badge [badge]
   (fn []

        [:div.image-container
         [:img.opaque {:src image :title "dummy badge"}]]]
       [:div.col-md-9
        [:div.row
         [:div.col-md-12
          [:h1.uppercase-header name]
          [:div.description description]
          [:div {:class "row criteria-html"}
           [:div.col-md-12
            [:h2.uppercase-header (t :badge/Criteria)]
            [:div {:dangerouslySetInnerHTML {:__html criteria}}]]]
          ]]]])))

(defn view-content [metabadge]
  (let [{:keys [badge required_badges milestone? min_required]} metabadge

    [:div.row.flip {:id "metabadgegrid"}
     [:div.col-md-3.badge-image
      [:div.image-container
       [:img {:src (:image badge) :class (if-not is-complete? " opaque")}]]
      [:div.progress
       [:div.progress-bar.progress-bar-success
        {:class (if  is-complete? "" " progress-bar-striped active")
