summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-25 11:29:35 +0200
committerVincent Petry <pvince81@owncloud.com>2015-08-25 11:29:35 +0200
commit5e6fa3c9389fcfa3af682f12fe0f54918ae6c85d (patch)
tree9ad639b3bc6d0a4ac9d9b1207e4ad2ad1f500212 /apps/files_trashbin
parenta86602a1575d829a64588b35eb073484ec9543db (diff)
downloadnextcloud-server-5e6fa3c9389fcfa3af682f12fe0f54918ae6c85d.tar.gz
nextcloud-server-5e6fa3c9389fcfa3af682f12fe0f54918ae6c85d.zip
Fix trashbin sidebar
Do not display size as it is not available. Use display name instead of name to remove the ".d123456" suffix.
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/js/filelist.js10
-rw-r--r--apps/files_trashbin/tests/js/filelistSpec.js20
2 files changed, 30 insertions, 0 deletions
diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js
index 71b63721897..febe3a45be3 100644
--- a/apps/files_trashbin/js/filelist.js
+++ b/apps/files_trashbin/js/filelist.js
@@ -122,6 +122,16 @@
return OC.linkTo('files', 'index.php')+"?view=trashbin&dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
},
+ elementToFile: function($el) {
+ var fileInfo = OCA.Files.FileList.prototype.elementToFile($el);
+ if (this.getCurrentDirectory() === '/') {
+ fileInfo.displayName = getDeletedFileName(fileInfo.name);
+ }
+ // no size available
+ delete fileInfo.size;
+ return fileInfo;
+ },
+
updateEmptyContent: function(){
var exists = this.$fileList.find('tr:first').exists();
this.$el.find('#emptycontent').toggleClass('hidden', exists);
diff --git a/apps/files_trashbin/tests/js/filelistSpec.js b/apps/files_trashbin/tests/js/filelistSpec.js
index 9aa1f907fa9..05caaf27865 100644
--- a/apps/files_trashbin/tests/js/filelistSpec.js
+++ b/apps/files_trashbin/tests/js/filelistSpec.js
@@ -212,6 +212,26 @@ describe('OCA.Trashbin.FileList tests', function() {
describe('breadcrumbs', function() {
// TODO: test label + URL
});
+ describe('elementToFile', function() {
+ var $tr;
+
+ beforeEach(function() {
+ fileList.setFiles(testFiles);
+ $tr = fileList.findFileEl('One.txt.d11111');
+ });
+
+ it('converts data attributes to file info structure', function() {
+ var fileInfo = fileList.elementToFile($tr);
+ expect(fileInfo.id).toEqual(1);
+ expect(fileInfo.name).toEqual('One.txt.d11111');
+ expect(fileInfo.displayName).toEqual('One.txt');
+ expect(fileInfo.mtime).toEqual(11111000);
+ expect(fileInfo.etag).toEqual('abc');
+ expect(fileInfo.permissions).toEqual(OC.PERMISSION_READ | OC.PERMISSION_DELETE);
+ expect(fileInfo.mimetype).toEqual('text/plain');
+ expect(fileInfo.type).toEqual('file');
+ });
+ });
describe('Global Actions', function() {
beforeEach(function() {
fileList.setFiles(testFiles);