Commit d35ff48e by Lyla Fischer Committed by Calen Pennington

fixed up some of the ajax feedback to display to the user

parent deca6e66
...@@ -234,25 +234,27 @@ function startUpload(e) { ...@@ -234,25 +234,27 @@ function startUpload(e) {
$('.upload-modal h1').html('Uploading…'); $('.upload-modal h1').html('Uploading…');
$('.upload-modal .file-name').html($('.file-input').val()); $('.upload-modal .file-name').html($('.file-input').val());
var bar = $('.progress-fill'); var bar = $('.upload-modal .progress-fill');
var percent = $('.percent');
$('.upload-modal .file-chooser').ajaxSubmit({ $('.upload-modal .file-chooser').ajaxSubmit({
beforeSend: function() { beforeSend: function() {
var percentVal = '0%'; var percentVal = '0%';
bar.width(percentVal) bar.width(percentVal)
percent.html(percentVal); bar.html(percentVal);
}, },
uploadProgress: function(event, position, total, percentComplete) { uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%'; var percentVal = percentComplete + '%';
bar.width(percentVal) bar.width(percentVal)
percent.html(percentVal); bar.html(percentVal);
}, },
complete: function(xhr) { complete: function(xhr) {
if(xhr.status = 200){
markAsLoaded(); markAsLoaded();
} }
bar.html(xhr.responseText);
$('.upload-modal .choose-file-button').html('Load Another File').show();
}
}); });
$('.upload-modal .choose-file-button').hide(); $('.upload-modal .choose-file-button').hide();
$('.upload-modal .progress-bar').removeClass('loaded').show(); $('.upload-modal .progress-bar').removeClass('loaded').show();
} }
...@@ -260,8 +262,6 @@ function startUpload(e) { ...@@ -260,8 +262,6 @@ function startUpload(e) {
function markAsLoaded() { function markAsLoaded() {
$('.upload-modal .copy-button').css('display', 'inline-block'); $('.upload-modal .copy-button').css('display', 'inline-block');
$('.upload-modal .progress-bar').addClass('loaded'); $('.upload-modal .progress-bar').addClass('loaded');
$('.upload-modal .progress-fill').html('loaded successfully');
$('.upload-modal .choose-file-button').html('Load Another File').show();
} }
function hideModal(e) { function hideModal(e) {
......
...@@ -188,8 +188,6 @@ ...@@ -188,8 +188,6 @@
<div class="progress-bar"> <div class="progress-bar">
<div class="progress-fill"></div> <div class="progress-fill"></div>
</div> </div>
<div class="percent">0%</div>
<div class="status"></div>
<a href="#" class="copy-button">Copy Embed Link</a> <a href="#" class="copy-button">Copy Embed Link</a>
<form class="file-chooser" action="${upload_asset_callback_url}" method="post" enctype="multipart/form-data"> <form class="file-chooser" action="${upload_asset_callback_url}" method="post" enctype="multipart/form-data">
<a href="#" class="choose-file-button">Choose File</a> <a href="#" class="choose-file-button">Choose File</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment