Skip to content

Instantly share code, notes, and snippets.

@quadrophobiac
Created September 23, 2015 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quadrophobiac/2d17531b99a8006a131a to your computer and use it in GitHub Desktop.
Save quadrophobiac/2d17531b99a8006a131a to your computer and use it in GitHub Desktop.
Rails & Bootstrap Magic in CSvlint Alphas
var r = new Resumable({
// resumable initialised
});
$('#standard_files').addClass('hidden');
// Resumable.js isn't supported, fall back on a different method
if(!r.support) {
console.log("support error");
$('#standard_files').removeClass('hidden');
$('.resumable-error').show();
} else {
$('#upload_button').removeClass('hidden');
// Show a place for dropping/selecting files
r.assignBrowse(document.getElementById('upload_button'));
// https://github.com/theodi/csvlint/blob/master/app/views/application/index.html.erb#L88
<%= file_field_tag 'files[]', title: 'Choose Files', id: 'standard_files', multiple: 'multiple' %>
<%= button_tag '<i class="glyphicon glyphicon-cloud-upload"></i> Choose a file'.html_safe, type: 'button', id: 'upload_button', class: 'btn-info btn-lg hidden' %>
<label style = "padding:8pt;" id="file_name"></label>
<div id="file_ids"></div>
# see https://github.com/theodi/csvlint/blob/master/app/views/application/index.html.erb#L26
@quadrophobiac
Copy link
Author

screen shot 2015-09-23 at 14 44 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment