jquery-fileupload-rails-paperclip-example
jquery-fileupload-rails-paperclip-example copied to clipboard
Moving 'template-upload' and 'template-download' JQuery templates outside the index.html.erb page
I am trying to move out the 'template-upload' and 'template-download' script to a separate .js file. They seem to be Jquery templates. How can you move them to a different file and then use them in the index.html.erb page
They aren't Javascript files but here's how to do it:
- Create two new files
_upload_template.html
and_download_template.html
. - Cut and past the upload and download template code from index to those files respectively.
- Add
<%= render "upload_template" %>
and<%= render "download_template" %>
to index where the old template code was.
You can see my updated example here (it also fixes the missing thumbnails): https://github.com/mikbe/jquery-fileupload-rails-paperclip-example