this.register('all', 'Delete', OC.PERMISSION_DELETE, function () {
return OC.imagePath('core', 'actions/delete');
}, function (filename, context) {
- context.fileList.do_delete(filename);
+ context.fileList.do_delete(filename, context.dir);
$('.tipsy').remove();
});
$.ajax({
url: OC.filePath('files','ajax','rename.php'),
data: {
- dir : self.getCurrentDirectory(),
+ dir : tr.attr('data-path') || self.getCurrentDirectory(),
newname: newName,
file: oldname
},
id: 18,
type: 'file',
name: 'testName.txt',
+ path: '/somepath/dir',
mimetype: 'text/plain',
size: '1234',
etag: 'a01234c',
$tr.find('.action.delete').click();
expect(deleteStub.calledOnce).toEqual(true);
+ expect(deleteStub.getCall(0).args[0]).toEqual('testName.txt');
+ expect(deleteStub.getCall(0).args[1]).toEqual('/somepath/dir');
deleteStub.restore();
});
it('passes context to action handler', function() {
var $input, request;
for (var i = 0; i < testFiles.length; i++) {
- fileList.add(testFiles[i], {silent: true});
+ var file = testFiles[i];
+ file.path = '/some/subdir';
+ fileList.add(file, {silent: true});
}
// trigger rename prompt
expect(fakeServer.requests.length).toEqual(1);
request = fakeServer.requests[0];
expect(request.url.substr(0, request.url.indexOf('?'))).toEqual(OC.webroot + '/index.php/apps/files/ajax/rename.php');
- expect(OC.parseQueryString(request.url)).toEqual({'dir': '/subdir', newname: 'Tu_after_three.txt', file: 'One.txt'});
+ expect(OC.parseQueryString(request.url)).toEqual({'dir': '/some/subdir', newname: 'Tu_after_three.txt', file: 'One.txt'});
}
it('Inserts renamed file entry at correct position if rename ajax call suceeded', function() {
doRename();