jquery-fileupload-rails-paperclip-example icon indicating copy to clipboard operation
jquery-fileupload-rails-paperclip-example copied to clipboard

Moving 'template-upload' and 'template-download' JQuery templates outside the index.html.erb page

Open amitjambusaria opened this issue 11 years ago • 1 comments

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

amitjambusaria avatar Jul 12 '13 18:07 amitjambusaria

They aren't Javascript files but here's how to do it:

  1. Create two new files _upload_template.html and _download_template.html.
  2. Cut and past the upload and download template code from index to those files respectively.
  3. 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

mikbe avatar Nov 10 '14 18:11 mikbe