From d35ff48e5b7ba24730f33bcb31bfc4c1cb6dd9a9 Mon Sep 17 00:00:00 2001 From: Lyla Fischer Date: Thu, 4 Oct 2012 16:30:55 -0400 Subject: [PATCH] fixed up some of the ajax feedback to display to the user --- cms/static/js/base.js | 18 +++++++++--------- cms/templates/asset_index.html | 4 +--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 0f42231c1c..4260e2525a 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -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(); diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index 41680ade6a..769ba65c7f 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -188,9 +188,7 @@
-
0%
-
- Copy Embed Link + Copy Embed Link
Choose File