diff options
author | Tomasz Grobelny <tomasz@grobelny.net> | 2018-11-13 18:30:32 +0100 |
---|---|---|
committer | Tomasz Grobelny <tomasz@grobelny.net> | 2018-11-24 23:55:17 +0100 |
commit | e99340dc4da5f3a86ae32a14ef318b0d8b8f20fd (patch) | |
tree | 07a8ed7971c703376d287e649da1e041a7a31552 /apps/files/js/file-upload.js | |
parent | 296e69fe045363286cacdf37feccfde70d4f2444 (diff) | |
download | nextcloud-server-e99340dc4da5f3a86ae32a14ef318b0d8b8f20fd.tar.gz nextcloud-server-e99340dc4da5f3a86ae32a14ef318b0d8b8f20fd.zip |
Move progress bar to separate component
Signed-off-by: Tomasz Grobelny <tomasz@grobelny.net>
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r-- | apps/files/js/file-upload.js | 34 |
1 files changed, 12 insertions, 22 deletions
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 @@ -429,6 +429,11 @@ OC.Uploader.prototype = _.extend({ fileList: null, /** + * @type OCA.Files.OperationProgressBar + */ + progressBar: null, + + /** * @type OC.Files.Client */ filesClient: null, @@ -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('<em class="label inner"><span class="desktop">' - + textDesktop - + '</span><span class="mobile">' - + textMobile - + '</span></em>'); - $('#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(); }); |