 (defn evidence-list [data state init-data]
   (let [evidence-name-atom (cursor state [:evidence :name])
         evidence-narrative-atom (cursor state [:evidence :narrative])
-        visibility-atom (cursor state [:evidence :properties :hidden])]
+        ]
     (reduce (fn [r evidence]
-              (let [{:keys [narrative description name id url mtime ctime evidence_type properties]} 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)]
-                (prn @visibility-atom)
-                (init-evidence-form evidence state true)
                 (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 evidence_type]] (hyperlink url)]
+                           [: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])]
 

                                            :evidence {:url value
                                                       :name name
                                                       :narrative description
                                                       :mime_type mime_type
                                                       :resource_id id
                                                       :resource_type (case key
                                                                        :page_input "page"
                                                                        :file_input "file")
                                                       :resource_visibility visibility})) }
      (case key
        :page_input [:div.resource  [:i.fa.fa-file-text-o] name]

     :handler (fn [data])}))

(defn save-badge-evidence [data state init-data]
  (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})
