found some more places where we can disable buttons while performing a action

This commit is contained in:
Björn Schießle 2013-07-26 14:54:27 +02:00
parent 9d24b9c7e8
commit efd8ad6696
1 changed files with 18 additions and 6 deletions

View File

@ -8,8 +8,7 @@ $(document).ready(function() {
var undeleteAction = $('tr').filterAttr('data-file',filename).children("td.date"); var undeleteAction = $('tr').filterAttr('data-file',filename).children("td.date");
var files = tr.attr('data-file'); var files = tr.attr('data-file');
undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner; undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner;
$(".action").css("display", "none"); disableActions();
$(":input:checkbox").css("display", "none");
$.post(OC.filePath('files_trashbin','ajax','undelete.php'), $.post(OC.filePath('files_trashbin','ajax','undelete.php'),
{files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') }, {files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') },
function(result){ function(result){
@ -20,8 +19,7 @@ $(document).ready(function() {
if (result.status != 'success') { if (result.status != 'success') {
OC.dialogs.alert(result.data.message, t('core', 'Error')); OC.dialogs.alert(result.data.message, t('core', 'Error'));
} }
$(".action").css("display", "inline"); enableActions();
$(":input:checkbox").css("display", "inline");
}); });
}); });
@ -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 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'); var files = tr.attr('data-file');
deleteAction[0].outerHTML = newHTML; deleteAction[0].outerHTML = newHTML;
disableActions();
$.post(OC.filePath('files_trashbin','ajax','delete.php'), $.post(OC.filePath('files_trashbin','ajax','delete.php'),
{files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') }, {files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') },
function(result){ function(result){
@ -49,6 +47,7 @@ $(document).ready(function() {
if (result.status != 'success') { if (result.status != 'success') {
OC.dialogs.alert(result.data.message, t('core', 'Error')); OC.dialogs.alert(result.data.message, t('core', 'Error'));
} }
enableActions();
}); });
}); });
@ -102,7 +101,7 @@ $(document).ready(function() {
var files=getSelectedFiles('file'); var files=getSelectedFiles('file');
var fileslist = JSON.stringify(files); var fileslist = JSON.stringify(files);
var dirlisting=getSelectedFiles('dirlisting')[0]; var dirlisting=getSelectedFiles('dirlisting')[0];
disableActions();
for (var i=0; i<files.length; i++) { for (var i=0; i<files.length; i++) {
var undeleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date"); var undeleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date");
undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner; undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner;
@ -118,6 +117,7 @@ $(document).ready(function() {
if (result.status != 'success') { if (result.status != 'success') {
OC.dialogs.alert(result.data.message, t('core', 'Error')); OC.dialogs.alert(result.data.message, t('core', 'Error'));
} }
enableActions();
}); });
}); });
@ -129,6 +129,7 @@ $(document).ready(function() {
var fileslist = JSON.stringify(files); var fileslist = JSON.stringify(files);
var dirlisting=getSelectedFiles('dirlisting')[0]; var dirlisting=getSelectedFiles('dirlisting')[0];
disableActions();
for (var i=0; i<files.length; i++) { for (var i=0; i<files.length; i++) {
var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date"); var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date");
deleteAction[0].innerHTML = deleteAction[0].innerHTML+spinner; deleteAction[0].innerHTML = deleteAction[0].innerHTML+spinner;
@ -144,6 +145,7 @@ $(document).ready(function() {
if (result.status != 'success') { if (result.status != 'success') {
OC.dialogs.alert(result.data.message, t('core', 'Error')); OC.dialogs.alert(result.data.message, t('core', 'Error'));
} }
enableActions();
}); });
}); });
@ -240,3 +242,13 @@ function getSelectedFiles(property){
function fileDownloadPath(dir, file) { function fileDownloadPath(dir, file) {
return OC.filePath('files_trashbin', '', 'download.php') + '?file='+encodeURIComponent(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");
}