mirror of
https://github.com/nextcloud/server.git
synced 2025-02-07 18:09:45 +00:00
![Daniel Calviño Sánchez](/assets/img/avatar_default.png)
When files are uploaded the progress bar text is set accordingly. However, other operations that show the progress bar, like deleting files, do not explicitly set any text. Due to that, when the progress bar was shown again after uploading files the text did not match the operation. To solve that now the text is cleared when the progress bar is hidden (it is not cleared when it is shown as in some cases the text is set already before showing the progress bar). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
83 lines
2.2 KiB
JavaScript
Executable file
83 lines
2.2 KiB
JavaScript
Executable file
/*
|
|
* Copyright (c) 2018
|
|
*
|
|
* This file is licensed under the Affero General Public License version 3
|
|
* or later.
|
|
*
|
|
* See the COPYING-README file.
|
|
*
|
|
*/
|
|
|
|
(function() {
|
|
var OperationProgressBar = OC.Backbone.View.extend({
|
|
tagName: 'div',
|
|
id: 'uploadprogresswrapper',
|
|
events: {
|
|
'click button.stop': '_onClickCancel'
|
|
},
|
|
|
|
render: function() {
|
|
this.$el.html(OCA.Files.Templates['operationprogressbar']({
|
|
textCancelButton: t('Cancel operation')
|
|
}));
|
|
this.setProgressBarText(t('Uploading …'), t('…'));
|
|
},
|
|
|
|
hideProgressBar: function() {
|
|
var self = this;
|
|
$('#uploadprogresswrapper .stop').fadeOut();
|
|
$('#uploadprogressbar').fadeOut(function() {
|
|
self.$el.trigger(new $.Event('resized'));
|
|
});
|
|
this.setProgressBarText('', '');
|
|
},
|
|
|
|
hideCancelButton: function() {
|
|
var self = this;
|
|
$('#uploadprogresswrapper .stop').fadeOut(function() {
|
|
self.$el.trigger(new $.Event('resized'));
|
|
});
|
|
},
|
|
|
|
showProgressBar: function(showCancelButton) {
|
|
if (showCancelButton) {
|
|
showCancelButton = true;
|
|
}
|
|
$('#uploadprogressbar').progressbar({value: 0});
|
|
if(showCancelButton) {
|
|
$('#uploadprogresswrapper .stop').show();
|
|
} else {
|
|
$('#uploadprogresswrapper .stop').hide();
|
|
}
|
|
$('#uploadprogresswrapper .label').show();
|
|
$('#uploadprogressbar').fadeIn();
|
|
this.$el.trigger(new $.Event('resized'));
|
|
},
|
|
|
|
setProgressBarValue: function(value) {
|
|
$('#uploadprogressbar').progressbar({value: value});
|
|
},
|
|
|
|
setProgressBarText: function(textDesktop, textMobile, title) {
|
|
var labelHtml = OCA.Files.Templates['operationprogressbarlabel']({textDesktop: textDesktop, textMobile: textMobile});
|
|
$('#uploadprogressbar .ui-progressbar-value').html(labelHtml);
|
|
$('#uploadprogressbar .ui-progressbar-value>em').addClass('inner');
|
|
$('#uploadprogressbar>em').replaceWith(labelHtml);
|
|
$('#uploadprogressbar>em').addClass('outer');
|
|
if (title) {
|
|
$('#uploadprogressbar').attr('title', title);
|
|
$('#uploadprogresswrapper .tooltip-inner').text(title);
|
|
}
|
|
if(textDesktop || textMobile) {
|
|
$('#uploadprogresswrapper .stop').show();
|
|
}
|
|
},
|
|
|
|
_onClickCancel: function (event) {
|
|
this.trigger('cancel');
|
|
return false;
|
|
}
|
|
});
|
|
|
|
OCA.Files.OperationProgressBar = OperationProgressBar;
|
|
})(OC, OCA);
|