 
 
 (defn badge-grid-element [element-data state badge-type init-data]
-  (let [{:keys [id image_file name description visibility expires_on revoked issuer_content_name issuer_content_url recipients badge_id assertion_url meta_badge meta_badge_req]} element-data
+  (let [{:keys [id image_file name description visibility expires_on revoked issuer_content_name issuer_content_url recipients badge_id assertion_url meta_badge meta_badge_req endorsement_count user_endorsements_count]} element-data
         expired? (bh/badge-expired? expires_on)
         obf_url (session/get :factory-url)
         metabadge-icon-fn (first (plugin-fun (session/get :plugins) "metabadge" "metabadge_icon"))]

                                      "internal" [:i {:class "fa fa-group"}]
                                      "public" [:i {:class "fa fa-globe"}]
                                      nil)
                                    (if metabadge-icon-fn [:div.pull-right [metabadge-icon-fn id]])]

                                   (if expires_on
                                     [:div.righticon

                                    [:p issuer_content_name]]]
                                  ]])

       (= "profile" badge-type) [:div.media-content
                                 [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id})}
                                  [:div.icons.col-xs-12 {:style {:padding "2px"}}
                                   [:div.visibility-icon.inline
                                    ;(if metabadge-icon-fn [:div.pull-right [metabadge-icon-fn id]])
                                    (when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o]])

                                    ]]
                                  [:div.media-left
                                   ;(when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o ]])
                                   (if image_file  [:img {:src (str "/" image_file) :alt name}])
                                   [:div.media-body
                                    [:div.media-heading name]
                                    [:div.media-issuer [:p issuer_content_name]]]
                                   ]]]

       (= "gallery" badge-type) [:div
                                 [:a {:href "#" :on-click #(mo/open-modal [:gallery :badges] {:badge-id badge_id})
