diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-03-26 10:29:01 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-03-26 10:35:27 +0100 |
commit | 92f0dba3c81046fa0dd665b35236da83123783f2 (patch) | |
tree | 87ad190917635908e3d83b6c78d19b371780061f /apps/files | |
parent | 40b77eb97ae7c3662a820060e021f36c3979c5e8 (diff) | |
download | nextcloud-server-92f0dba3c81046fa0dd665b35236da83123783f2.tar.gz nextcloud-server-92f0dba3c81046fa0dd665b35236da83123783f2.zip |
Show hidden files (dot files) in gray
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/js/filelist.js | 6 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 19 |
2 files changed, 24 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index f55e73b434b..67bc487a72f 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -743,8 +743,12 @@ // from here work on the display name name = fileData.displayName || name; + // show hidden files (starting with a dot) completely in gray + if(name.indexOf('.') === 0) { + basename = ''; + extension = name; // split extension from filename for non dirs - if (type !== 'dir' && name.indexOf('.') !== -1) { + } else if (type !== 'dir' && name.indexOf('.') !== -1) { basename = name.substr(0, name.lastIndexOf('.')); extension = name.substr(name.lastIndexOf('.')); } else { diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index bd3620e4b30..153cbe52c10 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -359,6 +359,25 @@ describe('OCA.Files.FileList tests', function() { expect($('#emptycontent').hasClass('hidden')).toEqual(true); expect(fileList.isEmpty).toEqual(false); }); + it('correctly adds the extension markup and show hidden files completely in gray', function() { + var $tr; + var testDataAndExpectedResult = [ + {file: {type: 'file', name: 'ZZZ.txt'}, extension: '.txt'}, + {file: {type: 'file', name: 'ZZZ.tar.gz'}, extension: '.gz'}, + {file: {type: 'file', name: 'test.with.some.dots.in.it.txt'}, extension: '.txt'}, + // we render hidden files completely in gray + {file: {type: 'file', name: '.test.with.some.dots.in.it.txt'}, extension: '.test.with.some.dots.in.it.txt'}, + {file: {type: 'file', name: '.hidden'}, extension: '.hidden'}, + ]; + fileList.setFiles(testFiles); + + for(var i = 0; i < testDataAndExpectedResult.length; i++) { + var testSet = testDataAndExpectedResult[i]; + var fileData = testSet['file']; + $tr = fileList.add(fileData); + expect($tr.find('.nametext .extension').text()).toEqual(testSet['extension']); + } + }); }); describe('Removing files from the list', function() { it('Removes file from list when calling remove() and updates summary', function() { |