show a spinner instead of the delete button while moving files to the trash bin

This commit is contained in:
Björn Schießle 2013-01-30 14:32:20 +01:00
parent e6f1544f51
commit 1592764a60
2 changed files with 16 additions and 3 deletions

View File

@ -111,6 +111,7 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; }
}
#fileList .fileactions a.action img { position:relative; top:.2em; }
#fileList a.action { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; }
#fileList img.move2trash { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; float:right; }
a.action.delete { float:right; }
a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
.selectedActions { display:none; float:right; }

View File

@ -271,13 +271,20 @@ var FileList={
}
},
do_delete:function(files){
if(files.substr){
files=[files];
}
for (var i in files) {
var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date").children(".action.delete");
var oldHTML = deleteAction[0].outerHTML;
var newHTML = '<img class="move2trash" data-action="Delete" title="move file to the trash bin" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
deleteAction[0].outerHTML = newHTML;
}
// Finish any existing actions
if (FileList.lastAction) {
FileList.lastAction();
}
if(files.substr){
files=[files];
}
var fileNames = JSON.stringify(files);
$.post(OC.filePath('files', 'ajax', 'delete.php'),
{dir:$('#dir').val(),files:fileNames},
@ -290,6 +297,11 @@ var FileList={
files.removeClass('selected');
});
procesSelection();
} else {
$.each(files,function(index,file) {
var deleteAction = $('tr').filterAttr('data-file',file).children("td.date").children(".move2trash");
deleteAction[0].outerHTML = oldHTML;
});
}
});
}