From 81e9d43e237fe80bf0b053bc8f5b34219da11a6e Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 11 Dec 2014 17:36:14 +0100 Subject: Move file thumbnail into the label element --- apps/files/js/filelist.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 6ffc10cdcbd..15f257bba92 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -93,6 +93,12 @@ */ fileActions: null, + /** + * Whether selection is allowed, checkboxes and selection overlay will + * be rendered + */ + _allowSelection: true, + /** * Map of file id to file data * @type Object. @@ -679,10 +685,8 @@ } // filename td - td = $('').attr({ - "class": "filename", - "style": 'background-image:url(' + icon + '); background-size: 32px;' - }); + td = $(''); + // linkUrl if (type === 'dir') { @@ -691,8 +695,16 @@ else { linkUrl = this.getDownloadUrl(name, path); } - td.append(''); + if (this._allowSelection) { + td.append( + '' + ); + } else { + td.append('
'); + } var linkElem = $('').attr({ "class": "name", "href": linkUrl @@ -888,6 +900,7 @@ this.fileActions.display(filenameTd, !options.silent, this); if (fileData.isPreviewAvailable) { + var iconDiv = filenameTd.find('.thumbnail'); // lazy load / newly inserted td ? if (options.animate) { this.lazyLoadPreview({ @@ -895,7 +908,7 @@ mime: mime, etag: fileData.etag, callback: function(url) { - filenameTd.css('background-image', 'url(' + url + ')'); + iconDiv.css('background-image', 'url(' + url + ')'); } }); } @@ -907,7 +920,7 @@ }; var previewUrl = this.generatePreviewUrl(urlSpec); previewUrl = previewUrl.replace('(', '%28').replace(')', '%29'); - filenameTd.css('background-image', 'url(' + previewUrl + ')'); + iconDiv.css('background-image', 'url(' + previewUrl + ')'); } } return tr; -- cgit v1.2.3