                                   ]])
 
        #_(= "export" badge-type) #_[:div {:key id}
-                                [:div.media-content
-                                 [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id})}
-                                  [:div.visibility-icon
-                                   (case visibility
-                                     "private" [:i {:class "fa fa-lock"}]
-                                     "internal" [:i {:class "fa fa-group"}]
-                                     "public" [:i {:class "fa fa-globe"}]
-                                     nil)]
-                                  (if image_file
-                                    [:div.media-left
-                                     [:img {:src (str "/" image_file) :alt name}]])
-                                  [:div.media-body
-                                   [:div.media-heading name]
-                                   [:div.media-issuer issuer_content_name]]]]
-                                [:div.media-bottom
-                                 [:div.row
-                                  [:div.col-xs-9
-                                   (let [checked? (boolean (some #(= id %) (:badges-selected @state)))]
-                                     [:div.checkbox
-                                      [:label {:for (str "checkbox-" id)}
-                                       [:input {:type "checkbox"
-                                                :id (str "checkbox-" id)
-                                                :on-change (fn []
-                                                             (if checked?
-                                                               (swap! state assoc :badges-selected (remove #(= % id) (:badges-selected @state)))
-                                                               (swap! state assoc :badges-selected (conj (:badges-selected @state) id))))
-                                                :checked checked?}]
+                                    [:div.media-content
+                                     [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id})}
+                                      [:div.visibility-icon
+                                       (case visibility
+                                         "private" [:i {:class "fa fa-lock"}]
+                                         "internal" [:i {:class "fa fa-group"}]
+                                         "public" [:i {:class "fa fa-globe"}]
+                                         nil)]
+                                      (if image_file
+                                        [:div.media-left
+                                         [:img {:src (str "/" image_file) :alt name}]])
+                                      [:div.media-body
+                                       [:div.media-heading name]
+                                       [:div.media-issuer issuer_content_name]]]]
+                                    [:div.media-bottom
+                                     [:div.row
+                                      [:div.col-xs-9
+                                       (let [checked? (boolean (some #(= id %) (:badges-selected @state)))]
+                                         [:div.checkbox
+                                          [:label {:for (str "checkbox-" id)}
+                                           [:input {:type "checkbox"
+                                                    :id (str "checkbox-" id)
+                                                    :on-change (fn []
+                                                                 (if checked?
+                                                                   (swap! state assoc :badges-selected (remove #(= % id) (:badges-selected @state)))
+                                                                   (swap! state assoc :badges-selected (conj (:badges-selected @state) id))))
+                                                    :checked checked?}]
 
-                                       (t :badge/Exporttobackpack)]])]
-                                  [:div {:class "col-xs-3 text-right"}
-                                   [:a {:href (str obf_url "/c/receive/download?url="(js/encodeURIComponent assertion_url)) :class "badge-download"}
-                                    [:i {:class "fa fa-download"}]]]]]]
+                                           (t :badge/Exporttobackpack)]])]
+                                      [:div {:class "col-xs-3 text-right"}
+                                       [:a {:href (str obf_url "/c/receive/download?url="(js/encodeURIComponent assertion_url)) :class "badge-download"}
+                                        [:i {:class "fa fa-download"}]]]]]]
 
        (= "gallery" badge-type) [:div
                                  [:a {:href "#" :on-click #(mo/open-modal [:gallery :badges] {:badge-id badge_id})

(ns salava.core.ui.badge-grid
  (:require [salava.badge.ui.helper :as bh]
            [salava.core.ui.helper :as h :refer [unique-values navigate-to path-for js-navigate-to plugin-fun]]
            [salava.core.i18n :as i18n :refer [t]]
            [salava.admin.ui.admintool :refer [admin-gallery-badge]]
            [salava.core.ui.modal :as mo]

              :on-click #(delete-badge id state init-data)}
     (t :core/Delete)]]])


(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
        expired? (bh/badge-expired? expires_on)
