From e99340dc4da5f3a86ae32a14ef318b0d8b8f20fd Mon Sep 17 00:00:00 2001 From: Tomasz Grobelny Date: Tue, 13 Nov 2018 18:30:32 +0100 Subject: Move progress bar to separate component Signed-off-by: Tomasz Grobelny --- apps/files/js/file-upload.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'apps/files/js/file-upload.js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index c16e734ac0a..741a6517af9 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -428,6 +428,11 @@ OC.Uploader.prototype = _.extend({ */ fileList: null, + /** + * @type OCA.Files.OperationProgressBar + */ + progressBar: null, + /** * @type OC.Files.Client */ @@ -778,39 +783,23 @@ OC.Uploader.prototype = _.extend({ }, _hideProgressBar: function() { - var self = this; - $('#uploadprogresswrapper .stop').fadeOut(); - $('#uploadprogressbar').fadeOut(function() { - self.$uploadEl.trigger(new $.Event('resized')); - }); + this.progressBar.hideProgressBar(); }, _hideCancelButton: function() { - $('#uploadprogresswrapper .stop').fadeOut(); + this.progressBar.hideCancelButton(); }, _showProgressBar: function() { - $('#uploadprogresswrapper .stop').show(); - $('#uploadprogresswrapper .label').show(); - $('#uploadprogressbar').fadeIn(); - this.$uploadEl.trigger(new $.Event('resized')); + this.progressBar.showProgressBar(); }, _setProgressBarValue: function(value) { - $('#uploadprogressbar').progressbar({value: value}); + this.progressBar.setProgressBarValue(value); }, _setProgressBarText: function(textDesktop, textMobile, title) { - $('#uploadprogressbar .ui-progressbar-value'). - html('' - + textDesktop - + '' - + textMobile - + ''); - $('#uploadprogressbar').tooltip({placement: 'bottom'}); - if(title) { - $('#uploadprogressbar').attr('original-title', title); - } + this.progressBar.setProgressBarText(textDesktop, textMobile, title); }, /** @@ -846,6 +835,7 @@ OC.Uploader.prototype = _.extend({ options = options || {}; this.fileList = options.fileList; + this.progressBar = options.progressBar; this.filesClient = options.filesClient || OC.Files.getClient(); this.davClient = new OC.Files.Client({ host: this.filesClient.getHost(), @@ -859,7 +849,7 @@ OC.Uploader.prototype = _.extend({ this.$uploadEl = $uploadEl; if ($uploadEl.exists()) { - $('#uploadprogresswrapper .stop').on('click', function() { + this.progressBar.on('cancel', function() { self.cancelUploads(); }); -- cgit v1.2.3