move updateFileActionSpinner to OCA.Files.FileActions
This commit is contained in:
parent
43afa4c0e3
commit
009d1f3214
3 changed files with 24 additions and 24 deletions
|
@ -488,10 +488,10 @@
|
|||
|
||||
if (url) {
|
||||
var disableLoadingState = function(){
|
||||
OCA.Files.Files.updateFileActionSpinner(downloadFileaction, false);
|
||||
OCA.Files.FileActions.updateFileActionSpinner(downloadFileaction, false);
|
||||
};
|
||||
|
||||
OCA.Files.Files.updateFileActionSpinner(downloadFileaction, true);
|
||||
OCA.Files.FileActions.updateFileActionSpinner(downloadFileaction, true);
|
||||
OCA.Files.Files.handleDownload(url, disableLoadingState);
|
||||
}
|
||||
}, t('files', 'Download'));
|
||||
|
@ -500,6 +500,26 @@
|
|||
|
||||
OCA.Files.FileActions = FileActions;
|
||||
|
||||
/**
|
||||
* Replaces the download icon with a loading spinner and vice versa
|
||||
* - also adds the class disabled to the passed in element
|
||||
*
|
||||
* @param downloadButtonElement download fileaction
|
||||
* @param {boolean} showIt whether to show the spinner(true) or to hide it(false)
|
||||
*/
|
||||
OCA.Files.FileActions.updateFileActionSpinner = function(downloadButtonElement, showIt) {
|
||||
var icon = downloadButtonElement.find('img'),
|
||||
sourceImage = icon.attr('src');
|
||||
|
||||
if(showIt) {
|
||||
downloadButtonElement.addClass('disabled');
|
||||
icon.attr('src', sourceImage.replace('actions/download.svg', 'loading-small.gif'));
|
||||
} else {
|
||||
downloadButtonElement.removeClass('disabled');
|
||||
icon.attr('src', sourceImage.replace('loading-small.gif', 'actions/download.svg'));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* File action attributes.
|
||||
*
|
||||
|
|
|
@ -427,10 +427,10 @@
|
|||
}
|
||||
|
||||
var disableLoadingState = function(){
|
||||
OCA.Files.Files.updateFileActionSpinner(downloadFileaction, false);
|
||||
OCA.Files.FileActions.updateFileActionSpinner(downloadFileaction, false);
|
||||
};
|
||||
|
||||
OCA.Files.Files.updateFileActionSpinner(downloadFileaction, true);
|
||||
OCA.Files.FileActions.updateFileActionSpinner(downloadFileaction, true);
|
||||
OCA.Files.Files.handleDownload(this.getDownloadUrl(files, dir), disableLoadingState);
|
||||
return false;
|
||||
},
|
||||
|
|
|
@ -301,26 +301,6 @@
|
|||
|
||||
OC.redirect(url + '&downloadStartSecret=' + randomToken);
|
||||
OC.Util.waitFor(checkForDownloadCookie, 500);
|
||||
},
|
||||
|
||||
/**
|
||||
* Replaces the download icon with a loading spinner and vice versa
|
||||
* - also adds the class disabled to the passed in element
|
||||
*
|
||||
* @param downloadButtonElement download fileaction
|
||||
* @param {boolean} showIt whether to show the spinner(true) or to hide it(false)
|
||||
*/
|
||||
updateFileActionSpinner: function(downloadButtonElement, showIt) {
|
||||
var icon = downloadButtonElement.find('img'),
|
||||
sourceImage = icon.attr('src');
|
||||
|
||||
if(showIt) {
|
||||
downloadButtonElement.addClass('disabled');
|
||||
icon.attr('src', sourceImage.replace('actions/download.svg', 'loading-small.gif'));
|
||||
} else {
|
||||
downloadButtonElement.removeClass('disabled');
|
||||
icon.attr('src', sourceImage.replace('loading-small.gif', 'actions/download.svg'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue