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

This commit is contained in:
Lyla Fischer
2012-10-04 16:30:55 -04:00
committed by Calen Pennington
parent deca6e66b0
commit d35ff48e5b
2 changed files with 10 additions and 12 deletions

View File

@@ -234,25 +234,27 @@ function startUpload(e) {
$('.upload-modal h1').html('Uploading…');
$('.upload-modal .file-name').html($('.file-input').val());
var bar = $('.progress-fill');
var percent = $('.percent');
var bar = $('.upload-modal .progress-fill');
$('.upload-modal .file-chooser').ajaxSubmit({
beforeSend: function() {
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
bar.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
bar.html(percentVal);
},
complete: function(xhr) {
markAsLoaded();
if(xhr.status = 200){
markAsLoaded();
}
bar.html(xhr.responseText);
$('.upload-modal .choose-file-button').html('Load Another File').show();
}
});
$('.upload-modal .choose-file-button').hide();
$('.upload-modal .progress-bar').removeClass('loaded').show();
}
@@ -260,9 +262,7 @@ function startUpload(e) {
function markAsLoaded() {
$('.upload-modal .copy-button').css('display', 'inline-block');
$('.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) {
e.preventDefault();

View File

@@ -188,9 +188,7 @@
<div class="progress-bar">
<div class="progress-fill"></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">
<a href="#" class="choose-file-button">Choose File</a>
<input type="file" class="file-input" name="file">