From eb6dba41d5adf42cf3e31f17f490fecbf6506789 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 26 Apr 2013 17:13:36 +0200 Subject: [PATCH] bug #1970: Add progress bar in files tab --- src/sunstone/public/js/plugins/files-tab.js | 33 ++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/sunstone/public/js/plugins/files-tab.js b/src/sunstone/public/js/plugins/files-tab.js index 597a780b70..eb0565b007 100644 --- a/src/sunstone/public/js/plugins/files-tab.js +++ b/src/sunstone/public/js/plugins/files-tab.js @@ -43,6 +43,11 @@ var files_tab_content = '\ \ \ \ +\ +
\ +
\ +
\ +
\
\
\
\ @@ -145,8 +150,8 @@ var create_file_tmpl =
\
\
\ -
\ -
\ +
\ +
\
\
\
\ @@ -801,16 +806,28 @@ function setupCreateFileDialog(){ // position: [pos_left, pos_top] // }); - var pb_dialog = $('
'+ - '
'+ - '
').addClass("reveal-modal"); + + $('#files_upload_progress_bars').append('
\ +
\ + '+tr("Uploading...")+'\ +
\ +
\ +
\ + \ +
\ +
'+id+' '+fileName+'
\ +
\ +
'); + + $('#files'+id+'cancel_upload').click(function(){ + uploader.cancel(); + }) //$('#upload-progress',pb_dialog).progressbar({value:0}); }, onProgress: function(id, fileName, loaded, total){ //update upload dialog with current progress - //$('div#pb_dialog #upload-progress').progressbar("option","value",Math.floor(loaded*100/total)); + $('span.meter', $('#files'+id+'progressBar')).css('width', Math.floor(loaded*100/total)+'%') }, onComplete: function(id, fileName, responseJSON){ @@ -818,9 +835,11 @@ function setupCreateFileDialog(){ uploader._handler._xhrs[id].status == 500) { onError({}, JSON.parse(uploader._handler._xhrs[id].response) ) + $('#files'+id+'progressBar').remove(); } else { notifyMessage("File uploaded correctly"); Sunstone.runAction("File.list"); + $('#files'+id+'progressBar').remove(); } //Inform complete upload, destroy upload dialog, refresh img list