summaryrefslogtreecommitdiffstats
path: root/apps/files
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
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')
-rw-r--r--apps/files/js/mainfileinfodetailview.js8
-rw-r--r--apps/files/tests/js/mainfileinfodetailviewSpec.js13
2 files changed, 17 insertions, 4 deletions
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js
index 8bf22149841..513f833299a 100644
--- a/apps/files/js/mainfileinfodetailview.js
+++ b/apps/files/js/mainfileinfodetailview.js
@@ -17,7 +17,7 @@
' class="action action-favorite favorite">' +
' <img class="svg" src="{{starIcon}}" />' +
' </a>' +
- ' <span class="size" title="{{altSize}}">{{size}}</span>, <span class="date" title="{{altDate}}">{{date}}</span>' +
+ ' {{#if hasSize}}<span class="size" title="{{altSize}}">{{size}}</span>, {{/if}}<span class="date" title="{{altDate}}">{{date}}</span>' +
'</div>';
/**
@@ -104,9 +104,10 @@
var isFavorite = (this.model.get('tags') || []).indexOf(OC.TAG_FAVORITE) >= 0;
this.$el.html(this.template({
nameLabel: t('files', 'Name'),
- name: this.model.get('name'),
+ name: this.model.get('displayName') || this.model.get('name'),
pathLabel: t('files', 'Path'),
path: this.model.get('path'),
+ hasSize: this.model.has('size'),
sizeLabel: t('files', 'Size'),
size: OC.Util.humanFileSize(this.model.get('size'), true),
altSize: n('files', '%n byte', '%n bytes', this.model.get('size')),
@@ -120,8 +121,7 @@
// TODO: we really need OC.Previews
var $iconDiv = this.$el.find('.thumbnail');
if (!this.model.isDirectory()) {
- // TODO: inject utility class?
- FileList.lazyLoadPreview({
+ this._fileList.lazyLoadPreview({
path: this.model.getFullPath(),
mime: this.model.get('mimetype'),
etag: this.model.get('etag'),
diff --git a/apps/files/tests/js/mainfileinfodetailviewSpec.js b/apps/files/tests/js/mainfileinfodetailviewSpec.js
index ca7384f6207..582824585b5 100644
--- a/apps/files/tests/js/mainfileinfodetailviewSpec.js
+++ b/apps/files/tests/js/mainfileinfodetailviewSpec.js
@@ -100,6 +100,19 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() {
fileListMock.verify();
});
+ it('does not show size if no size available', function() {
+ testFileInfo.unset('size');
+ view.setFileInfo(testFileInfo);
+
+ expect(view.$el.find('.size').length).toEqual(0);
+ });
+ it('renders displayName instead of name if available', function() {
+ testFileInfo.set('displayName', 'hello.txt');
+ view.setFileInfo(testFileInfo);
+
+ expect(view.$el.find('.fileName').text()).toEqual('hello.txt');
+ expect(view.$el.find('.fileName').attr('title')).toEqual('hello.txt');
+ });
it('rerenders when changes are made on the model', function() {
view.setFileInfo(testFileInfo);