I am using this application
examplehttps://github.com/tors/jquery-fileupload-rails-paperclip-exampleand
try to model it to fit my needs.
I am modelling your index.html.erb to fit my needs.
I want to get rid of “start” button in order to prevent single-file
upload
(I dont want it), but it seems that “start upload”(multiple
upload)-button
is on “start” button dependent and I could not find how to modify the
script in order to get rid of “start”-buttom but to keep the
functionality
of a “start upload” -button.
Can you give me some hints how to get rid of those dependencies?
Hier is the short code cut-off:
I have marked the lines where “start upload” and “start” buttons are
situated with !!!.
<div class="container">
<h2>Upload file</h2>
<%= form_for Upload.new, :html => { :multipart => true, :id =>
“fileupload” } do |f| %>
Add files…
<%= f.file_field :upload %>
!!! Start upload
Cancel upload
Delete
<% end %>
</div>
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td class="preview"><span class="fade"></span></td>
<td class="name"><span>{%=file.name%}</span></td>
<td
class=“size”>{%=o.formatFileSize(file.size)%}
{% if (file.error) { %}
{%=locale.fileupload.error%}
{%=locale.fileupload.errors[file.error] || file.error%}
{% } else if (o.files.valid && !i) { %}
!!! {% if (!o.options.autoUpload) { %}
{%=locale.fileupload.start%}
{% } %}
{% } else { %}
{% } %}
{% if (!i) { %}
{%=locale.fileupload.cancel%}
{% } %}
{% } %}
<script type="text/javascript" charset="utf-8">
$(function () {
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload();
//
// Load existing files:
$.getJSON($('#fileupload').prop('action'), function
(files) {
var fu = $(‘#fileupload’).data(‘fileupload’),
template;
fu._adjustMaxNumberOfFiles(-files.length);
console.log(files);
template = fu._renderDownload(files)
.appendTo($(‘#fileupload .files’));
// Force reflow:
fu._reflow = fu._transition && template.length &&
template[0].offsetWidth;
template.addClass(‘in’);
$(‘#loading’).remove();
});
});
</script>
Thank you.
Cheers, Katja