2

I use ActiveAdmin to upload featured images to posts. It works but after I save the post, and click on edit, the image field is empty, although the image is still attached to it. What I want to achieve is after upload I would like to show the thumbnail of the image below the image upload field, with an option to remove/delete the image (preferably without touching the save button).

I also use the activeadmin-wysihtml5 gem along with the activeadmin-dragonfly gem which handles image uploads when I want to insert images in the body of the post through the editor. These gems also created an Assets link in ActiveAdmin, where I can see and handle all the uploaded images. Is it possible to do this with Carrierwave? Or maybe make Carrierwave use the existing assets and upload there?

Best Wishes, Matt

Allanon
  • 547
  • 4
  • 24

1 Answers1

1

The answer to this is featured on ActiveAdmin Wiki as Showing an uploaded image in the form

f.inputs "Attachment", :multipart => true do 
  f.input :cover_page, :as => :file, :hint => f.object.cover_page.present? \
    ? f.template.image_tag(f.object.cover_page.url(:thumb))
    : f.template.content_tag(:span, "no cover page yet")
  f.input :cover_page_cache, :as => :hidden 
end
baxang
  • 3,627
  • 1
  • 29
  • 27