Can carrierwave-crop do JS?

114 Views Asked by At

I got carrierwave and carrierwave-crop which are working just fine. Now I want the file upload to be executed via JS like this:

  1. User selects a photo to upload
  2. Form is sent and photo uploaded once selected
  3. The crop view gets rendered via JS
  4. Cropping is submitted via JS
  5. Newly cropped photo appears

Is there anyway I can do this with carrierwave-crop? I already added remotipart for JS file upload. All I need now is the proper handling in the controller and js file. Just don't know how to start.

* EDIT *

I have managed everything except one thing. This is what happens: 1. User selects a photo which is uploaded via AJAX, file select box closes 2. The crop view is rendered via AJX into a newly created modal window which also appears.

However, the cropping stuff doesn't appear because, I would say, the cropping JS isn't executed.

  • Tried to move the JS stuff into the response JS - modal window doesn't show anymore
  • Tried to move the JS stuff into the view so it gets executed when loaded - modal window doesn't show anymore.

Anyone has an idea what I'm missing here?

0

There are 0 best solutions below