      :handler (fn [data])}))
 
 (defn save-badge-evidence [data state init-data]
-  (let [{:keys [id name narrative url resource_visibility resource_id resource_type mime_type]} (:evidence @state)
+  (let [{:keys [id name narrative url resource_visibility properties]} (:evidence @state)
+        {:keys [resource_type mime_type resource_id]} properties
         badge-id (:id data)
         init-settings (first (plugin-fun (session/get :plugins) "modal" "show_settings_dialog"))]
     (swap! state assoc :evidence {:message nil})

                                          :class "close evidence-toggle"
                                          :on-click #(do
                                                       (.preventDefault %)
                                                       (toggle-show-evidence! id data state init-data))} [:i.fa.show-more {:class (if @visibility-atom (str " fa-toggle-off") (str " fa-toggle-on"))
                                                                                            :title (if @visibility-atom (t :badge/Showevidence) (t :badge/Showevidence))}]]]
                          (when added-by-user?
                            [:div [:div [:button {:type "button"
                                                  :aria-label "OK"

(defn evidence-list [data state init-data]
  (let [evidence-name-atom (cursor state [:evidence :name])
        evidence-narrative-atom (cursor state [:evidence :narrative])
        ]
    (reduce (fn [r evidence]
              (let [{:keys [narrative description name id url mtime ctime properties]} evidence
                    {:keys [resource_id resource_type mime_type hidden]} properties
                    added-by-user? (and (not (blank? description)) (starts-with? description "Added by badge recipient"))
                    desc (cond
                           (not (blank? narrative)) narrative
                           (not added-by-user?) description ;;todo use regex to match description
                           :else nil)]
                (conj r
                      (when-not (blank? url)
                        [:div.panel.panel-default
                         [:div.panel-heading {:id (str "heading" id)
                                              :role "tab"}
                          [:div.panel-title
                           [:div.url [:div {:style {:float "left"}} [evidence-icon {:type resource_type :mime_type mime_type}]]
                            (case resource_type
                              "file" (hyperlink url)
                              "page" (if (session/get :user)
                                       [:a {:href "#"
                                            :on-click #(do
                                                         (.preventDefault %)
                                                         (mo/open-modal [:page :view] {:page-id resource_id}))} url]
                                       (hyperlink url))
                              (hyperlink url))]
                           (when-not (blank? name) [:div.inline [:label (t :badge/Name) ": "] name])
                           (when-not (blank? desc) [:div [:label (t :admin/Description) ": "]   desc])]

