diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-12-11 17:36:14 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-12-11 18:21:25 +0100 |
commit | 81e9d43e237fe80bf0b053bc8f5b34219da11a6e (patch) | |
tree | 886c04392d8e8b1b1309a66f43883abaf0af3376 /apps/files/js | |
parent | acc9af8fc92ea315668e80617e5496e60a97d788 (diff) | |
download | nextcloud-server-81e9d43e237fe80bf0b053bc8f5b34219da11a6e.tar.gz nextcloud-server-81e9d43e237fe80bf0b053bc8f5b34219da11a6e.zip |
Move file thumbnail into the label element
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 29 |
1 files changed, 21 insertions, 8 deletions
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 @@ -94,6 +94,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.<int, Object> */ @@ -679,10 +685,8 @@ } // filename td - td = $('<td></td>').attr({ - "class": "filename", - "style": 'background-image:url(' + icon + '); background-size: 32px;' - }); + td = $('<td class="filename"></td>'); + // linkUrl if (type === 'dir') { @@ -691,8 +695,16 @@ else { linkUrl = this.getDownloadUrl(name, path); } - td.append('<input id="select-' + this.id + '-' + fileData.id + - '" type="checkbox" /><label for="select-' + this.id + '-' + fileData.id + '"></label>'); + if (this._allowSelection) { + td.append( + '<input id="select-' + this.id + '-' + fileData.id + + '" type="checkbox" /><label for="select-' + this.id + '-' + fileData.id + '">' + + '<div class="thumbnail" style="background-image:url(' + icon + '); background-size: 32px;"></div>' + + '</label>' + ); + } else { + td.append('<div class="thumbnail" style="background-image:url(' + icon + '); background-size: 32px;"></div>'); + } var linkElem = $('<a></a>').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; |