diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-07-26 14:54:27 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-07-26 14:54:27 +0200 |
commit | efd8ad6696ebc8ff138ad71df4c0c0b788f19b6f (patch) | |
tree | 030207ff3b90dfd36e09672c3e7cd60e0b5fdef6 /apps | |
parent | 9d24b9c7e890de4094bfc83cf17392a4001b6509 (diff) | |
download | nextcloud-server-efd8ad6696ebc8ff138ad71df4c0c0b788f19b6f.tar.gz nextcloud-server-efd8ad6696ebc8ff138ad71df4c0c0b788f19b6f.zip |
found some more places where we can disable buttons while performing a action
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_trashbin/js/trash.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js index 2ced7da44b1..409e3e59d5a 100644 --- a/apps/files_trashbin/js/trash.js +++ b/apps/files_trashbin/js/trash.js @@ -8,8 +8,7 @@ $(document).ready(function() { var undeleteAction = $('tr').filterAttr('data-file',filename).children("td.date"); var files = tr.attr('data-file'); undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner; - $(".action").css("display", "none"); - $(":input:checkbox").css("display", "none"); + disableActions(); $.post(OC.filePath('files_trashbin','ajax','undelete.php'), {files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') }, function(result){ @@ -20,8 +19,7 @@ $(document).ready(function() { if (result.status != 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } - $(".action").css("display", "inline"); - $(":input:checkbox").css("display", "inline"); + enableActions(); }); }); @@ -38,7 +36,7 @@ $(document).ready(function() { var newHTML = '<img class="move2trash" data-action="Delete" title="'+t('files', 'delete file permanently')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>'; var files = tr.attr('data-file'); deleteAction[0].outerHTML = newHTML; - + disableActions(); $.post(OC.filePath('files_trashbin','ajax','delete.php'), {files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') }, function(result){ @@ -49,6 +47,7 @@ $(document).ready(function() { if (result.status != 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } + enableActions(); }); }); @@ -102,7 +101,7 @@ $(document).ready(function() { var files=getSelectedFiles('file'); var fileslist = JSON.stringify(files); var dirlisting=getSelectedFiles('dirlisting')[0]; - + disableActions(); for (var i=0; i<files.length; i++) { var undeleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date"); undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner; @@ -118,6 +117,7 @@ $(document).ready(function() { if (result.status != 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } + enableActions(); }); }); @@ -129,6 +129,7 @@ $(document).ready(function() { var fileslist = JSON.stringify(files); var dirlisting=getSelectedFiles('dirlisting')[0]; + disableActions(); for (var i=0; i<files.length; i++) { var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date"); deleteAction[0].innerHTML = deleteAction[0].innerHTML+spinner; @@ -144,6 +145,7 @@ $(document).ready(function() { if (result.status != 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } + enableActions(); }); }); @@ -240,3 +242,13 @@ function getSelectedFiles(property){ function fileDownloadPath(dir, file) { return OC.filePath('files_trashbin', '', 'download.php') + '?file='+encodeURIComponent(file); } + +function enableActions() { + $(".action").css("display", "inline"); + $(":input:checkbox").css("display", "inline"); +} + +function disableActions() { + $(".action").css("display", "none"); + $(":input:checkbox").css("display", "none"); +} |