 
 (defn visibility-modal [badge state reload-fn]
   (let [visibility (atom (:visibility badge))]
-  (create-class {:reagent-render
-                 (fn [] [:div#badge-settings {:style {:padding "10px"}}
-                         [:form {:class "form-horizontal"}
-                          [:div ;{:class "col-md-12"}
-                           [:fieldset {:class "form-group visibility"}
-                            [:legend {:class "col-md-9 sub-heading"}
-                             (t :badge/Badgevisibility) [info {:content (t :badge/Visibilityinfo) :placement "right"}]]
-                            [:div {:class (str "col-md-12 " @visibility) :style {:margin-top "20px"}}
-                             (if-not (private?)
-                               [:div [:input {:id              "visibility-public"
+    (create-class {:reagent-render
+                   (fn [] [:div#badge-settings {:style {:padding "10px"}}
+                           [:form {:class "form-horizontal"}
+                            [:div ;{:class "col-md-12"}
+                             [:fieldset {:class "form-group visibility"}
+                              [:legend {:class "col-md-9 sub-heading"}
+                               (t :badge/Badgevisibility) [info {:content (t :badge/Visibilityinfo) :placement "right"}]]
+                              [:div {:class (str "col-md-12 " @visibility) :style {:margin-top "20px"}}
+                               (if-not (private?)
+                                 [:div [:input {:id              "visibility-public"
+                                                :name            "visibility"
+                                                :value           "public"
+                                                :type            "radio"
+                                                :on-change       #(do
+                                                                    (.preventDefault %)
+                                                                    (reset! visibility "public"))}]
+                                  [:i {:class "fa fa-globe" }]
+                                  [:label {:for "visibility-public"}
+                                   (t :badge/Public)]])
+                               [:div [:input {:id              "visibility-internal"
                                               :name            "visibility"
-                                              :value           "public"
+                                              :value           "internal"
                                               :type            "radio"
                                               :on-change       #(do
                                                                   (.preventDefault %)
-                                                                  (reset! visibility "public"))}]
-                                [:i {:class "fa fa-globe" }]
-                                [:label {:for "visibility-public"}
-                                 (t :badge/Public)]])
-                             [:div [:input {:id              "visibility-internal"
-                                            :name            "visibility"
-                                            :value           "internal"
-                                            :type            "radio"
-                                            :on-change       #(do
-                                                                (.preventDefault %)
-                                                                (reset! visibility "internal"))}]
-                              [:i {:class "fa fa-group" }]
-                              [:label {:for "visibility-internal"}
-                               (t :badge/Shared)]]
-                             [:div [:input {:id              "visibility-private"
-                                            :name            "visibility"
-                                            :value           "private"
-                                            :type            "radio"
-                                            :on-change       #(do
-                                                                (.preventDefault %)
-                                                                (reset! visibility "private"))
-                                            :default-checked (= "private" (:visibility badge)) #_(= "private" (:visibility badge) #_(get-in @state [:badge-settings :visibility]))}]
-                              [:i {:class "fa fa-lock" }]
-                              [:label {:for "visibility-private"}
-                               (t :badge/Private)]]]]]]
-                         [:hr.border]
-                         [:button.btn.btn-primary {:on-click #(do
-                                                                (.preventDefault %)
-                                                                (update-visibility @visibility badge state reload-fn)
-                                                                )
-                                                   :data-dismiss "modal"}(t :core/Save)]
-                         ])
-                 :component-will-unmount (fn [] (m/close-modal!))})))
+                                                                  (reset! visibility "internal"))}]
+                                [:i {:class "fa fa-group" }]
+                                [:label {:for "visibility-internal"}
+                                 (t :badge/Shared)]]
+                               [:div [:input {:id              "visibility-private"
+                                              :name            "visibility"
+                                              :value           "private"
+                                              :type            "radio"
+                                              :on-change       #(do
+                                                                  (.preventDefault %)
+                                                                  (reset! visibility "private"))
+                                              :default-checked (= "private" (:visibility badge)) #_(= "private" (:visibility badge) #_(get-in @state [:badge-settings :visibility]))}]
+                                [:i {:class "fa fa-lock" }]
+                                [:label {:for "visibility-private"}
+                                 (t :badge/Private)]]]]]]
+                           [:hr.border]
+                           [:button.btn.btn-primary {:on-click #(do
+                                                                  (.preventDefault %)
+                                                                  (update-visibility @visibility badge state)
+                                                                  )
+                                                     :data-dismiss "modal"}(t :core/Save)]
+                           ])
+                   :component-will-unmount (fn [] (m/close-modal!))})))
 
 (defn badge-pending [badge state reload-fn]
   [:div.row {:key (:id badge)}

     :keywords? true
     :params {:status new-status}
     :handler (fn []
                  (js/setTimeout (fn [] (swap! state assoc :badge-alert nil)) 3000)
                #_(reload-fn state))
     :error-handler (fn [{:keys [status status-text]}])}))

(defn update-visibility [visibility badge state reload-fn]
  (swap! state assoc :badge-alert nil)
  (ajax/POST
    (path-for (str "/obpv1/badge/set_visibility/" (:id badge)))
    {:params {:visibility visibility}
     :handler (fn [data]
                (when (= (:status data) "success")
                  (update-status (:id badge) "accepted" state reload-fn)
                  (swap! state assoc :badge-alert "accepted" :badge-name (:name badge))
                  ))}))


          }(t :admin/Showmore)]
     [show-more-content state]]))


(defn pending-badge-content [{:keys [id image_file name description visibility assertion_url meta_badge meta_badge_req issuer_content_name issuer_content_url issued_on issued_by_obf verified_by_obf obf_url]}]
  (let [state (atom {:id id
