Last active
August 29, 2015 14:23
-
-
Save danielfone/daa8d542d2282d23ff68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery -> | |
$('.cloudinary-fileupload').on 'cloudinarydone', (e, data) -> | |
$('.js-cl-preview').html $.cloudinary.image data.result.public_id, { | |
format: data.result.format, | |
version: data.result.version, | |
width: 150, | |
height: 100, | |
} | |
$('.cloudinary-fileupload').on 'fileuploaddone', -> $('.js-cl-progress').hide() | |
$('.cloudinary-fileupload').on 'fileuploadsend', -> $('.js-cl-progress').show() | |
$('.cloudinary-fileupload').on 'fileuploadprogress', (e, data) -> | |
$('.js-cl-progress .progress-bar').css('width', Math.round((data.loaded * 100.0) / data.total) + '%') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form.form_group do %> | |
<%= form.label "Photo" %> | |
<%= cl_image_upload_tag 'panel[photo_token]', folder: 'prod/panel/photo' %> | |
<div class="progress js-cl-progress" style="display:none"> | |
<div class="progress-bar progress-bar-striped" role="progressbar" style="width: 0%"></div> | |
</div> | |
<div class="js-cl-preview"></div> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment