Browse Source

progress bar

master
Pascal Gloor 5 years ago
parent
commit
d8189e9d8f
2 changed files with 32 additions and 19 deletions
  1. 20
    16
      www/index.html
  2. 12
    3
      www/js/autodoc.js

+ 20
- 16
www/index.html View File



<!-- Upload --> <!-- Upload -->
<div class="container d-none" id="autodoc_tab_upload"> <div class="container d-none" id="autodoc_tab_upload">
<h3>upload</h3>
<div class="row">
<div class="col">
<div class="d-none autodoc_template_progress">
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated"></div>
</div>
</div>
<h3>upload</h3>
<div class="row">
<div class="col">


<div class="lead">Upload Zone</div>
<div class="lead">Upload Zone</div>


<div class="text-center autodoc_upload_zone">
Drag & Drop files (png, jpeg, pdf) into this zone to attach them to a single new document<br/>
Files can be uploaded at once or separately. A long as the page is not refreshed or the new document
button
is pushed, they will all be attached to the same document
</div>
<div class="text-center autodoc_upload_zone">
Drag & Drop files (png, jpeg, pdf) into this zone to attach them to a single new document<br />
Files can be uploaded at once or separately. A long as the page is not refreshed or the new document
button
is pushed, they will all be attached to the same document
</div>




</div>
</div>


<div class="col">
<div class="lead">Upload Status</div>
<div class="autodoc_upload_template_progress progress d-none">
<div class="progress-bar progress-bar-striped progress-bar-animated"></div>
</div>
<div class="col">
<div class="lead">Upload Status</div>

</div>
</div> </div>


</div> </div>

+ 12
- 3
www/js/autodoc.js View File



if ( temp.documentid == null ) { if ( temp.documentid == null ) {
$.post(conf.openapi + "/documents", {}, function(data) { $.post(conf.openapi + "/documents", {}, function(data) {
temp.upload = [];
temp.documentid = data.id; temp.documentid = data.id;
upload_status();
handle_uploads(ev); handle_uploads(ev);
}); });
} }


function handle_uploads(ev) { function handle_uploads(ev) {



$.each(ev.dataTransfer.files, function(id,file) { $.each(ev.dataTransfer.files, function(id,file) {
var fileid = temp.upload.length; var fileid = temp.upload.length;
temp.upload.push({ temp.upload.push({
}); });
if ( file.type != 'application/pdf' && file.type != 'image/png' && file.type != 'image/jpeg' ) { if ( file.type != 'application/pdf' && file.type != 'image/png' && file.type != 'image/jpeg' ) {
temp.upload['progress']=1;
temp.upload['error']='invalid file type';
temp.upload[fileid]['progress']=1;
temp.upload[fileid]['error']='invalid file type';
} }
else { else {
var reader = new FileReader(); var reader = new FileReader();
} }
}); });
return true; return true;
}

function upload_status() {
$.each(temp.upload, function(id, file) {
var obj = $(".autodoc_template_progress").children();
console.log(obj);
});
// setTimeout(upload_status, 1000);
} }

Loading…
Cancel
Save