summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/js
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-09 12:01:25 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-09 12:01:25 +0200
commit9e3d28871e837d42fa495a9237bea24b0f0fd414 (patch)
tree51c5a099a2f011c2395a40c5517031433da26c03 /apps/files_trashbin/js
parent44049639189b8f93b34039ba063e4151e03dfaa7 (diff)
downloadnextcloud-server-9e3d28871e837d42fa495a9237bea24b0f0fd414.tar.gz
nextcloud-server-9e3d28871e837d42fa495a9237bea24b0f0fd414.zip
fix delete/restore individual files
Diffstat (limited to 'apps/files_trashbin/js')
-rw-r--r--apps/files_trashbin/js/trash.js49
1 files changed, 23 insertions, 26 deletions
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js
index d73eadb6011..c530727e623 100644
--- a/apps/files_trashbin/js/trash.js
+++ b/apps/files_trashbin/js/trash.js
@@ -4,14 +4,13 @@ $(document).ready(function() {
if (typeof FileActions !== 'undefined') {
FileActions.register('all', 'Restore', OC.PERMISSION_READ, OC.imagePath('core', 'actions/history'), function(filename) {
var tr=$('tr').filterAttr('data-file', filename);
- var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'perform restore operation')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
- var undeleteAction = $('tr').filterAttr('data-file',filename).children("td.date");
- var files = tr.attr('data-file');
- undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner;
+ var deleteAction = $('tr').filterAttr('data-file',filename).children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
disableActions();
$.post(OC.filePath('files_trashbin','ajax','undelete.php'),
- {files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') },
+ {files:JSON.stringify([filename]), dirlisting:tr.attr('data-dirlisting') },
function(result){
+ console.log("get result");
for (var i = 0; i < result.data.success.length; i++) {
var row = document.getElementById(result.data.success[i].filename);
row.parentNode.removeChild(row);
@@ -30,16 +29,12 @@ $(document).ready(function() {
return OC.imagePath('core', 'actions/delete');
}, function (filename) {
$('.tipsy').remove();
-
var tr=$('tr').filterAttr('data-file', filename);
var deleteAction = $('tr').filterAttr('data-file',filename).children("td.date").children(".action.delete");
- var oldHTML = deleteAction[0].outerHTML;
- 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;
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
disableActions();
$.post(OC.filePath('files_trashbin','ajax','delete.php'),
- {files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') },
+ {files:JSON.stringify([filename]), dirlisting:tr.attr('data-dirlisting') },
function(result){
for (var i = 0; i < result.data.success.length; i++) {
var row = document.getElementById(result.data.success[i].filename);
@@ -50,9 +45,10 @@ $(document).ready(function() {
}
enableActions();
FileList.updateFileSummary();
- });
+ }
+ );
- });
+ });
// Sets the select_all checkbox behaviour :
$('#select_all').click(function() {
@@ -110,22 +106,23 @@ $(document).ready(function() {
}
$.post(OC.filePath('files_trashbin','ajax','undelete.php'),
- {files:fileslist, dirlisting:dirlisting},
- function(result){
- for (var i = 0; i < result.data.success.length; i++) {
- var row = document.getElementById(result.data.success[i].filename);
- row.parentNode.removeChild(row);
- }
- if (result.status !== 'success') {
- OC.dialogs.alert(result.data.message, t('core', 'Error'));
- }
- enableActions();
- });
- });
+ {files:fileslist, dirlisting:dirlisting},
+ function(result){
+ for (var i = 0; i < result.data.success.length; i++) {
+ var row = document.getElementById(result.data.success[i].filename);
+ row.parentNode.removeChild(row);
+ }
+ if (result.status !== 'success') {
+ OC.dialogs.alert(result.data.message, t('core', 'Error'));
+ }
+ enableActions();
+ }
+ );
+
+ });
$('.delete').click('click',function(event) {
event.preventDefault();
- console.log("delete selected");
var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'Delete permanently')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
var files=getSelectedFiles('file');
var fileslist = JSON.stringify(files);