From 16c29021e6e4c2d879cd9d5d5d9b8f3feec61861 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 29 Jun 2015 08:52:37 +0200 Subject: Add loading spinner to multi select download button --- apps/files/js/filelist.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'apps/files/js/filelist.js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 417c4b9fe99..807d1a16891 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -417,6 +417,26 @@ else { files = _.pluck(this.getSelectedFiles(), 'name'); } + + var downloadFileaction = $('#selectedActionsList').find('.download'); + + // don't allow a second click on the download action + if(downloadFileaction.hasClass('disabled')) { + event.preventDefault(); + return; + } + + downloadFileaction.addClass('disabled'); + var icon = downloadFileaction.find('img'); + var sourceImage = icon.attr('src'); + icon.attr('src', sourceImage.replace('actions/download.svg', 'loading-small.gif')); + + // TODO proper detection of "download has started" + setTimeout(function(){ + icon.attr('src', sourceImage); + downloadFileaction.removeClass('disabled'); + }, 7000); + OC.redirect(this.getDownloadUrl(files, dir)); return false; }, -- cgit v1.2.3