only load sidebar previews when we know it's available
This commit is contained in:
parent
276383ebf5
commit
b9dfc1674c
|
@ -852,7 +852,8 @@
|
|||
type: $el.attr('data-type'),
|
||||
size: parseInt($el.attr('data-size'), 10),
|
||||
etag: $el.attr('data-etag'),
|
||||
permissions: parseInt($el.attr('data-permissions'), 10)
|
||||
permissions: parseInt($el.attr('data-permissions'), 10),
|
||||
hasPreview: $el.attr('data-has-preview') === 'true'
|
||||
};
|
||||
var icon = $el.attr('data-icon');
|
||||
if (icon) {
|
||||
|
@ -1068,7 +1069,8 @@
|
|||
"data-mime": mime,
|
||||
"data-mtime": mtime,
|
||||
"data-etag": fileData.etag,
|
||||
"data-permissions": fileData.permissions || this.getDirectoryPermissions()
|
||||
"data-permissions": fileData.permissions || this.getDirectoryPermissions(),
|
||||
"data-has-preview": fileData.hasPreview !== false
|
||||
});
|
||||
|
||||
if (dataIcon) {
|
||||
|
|
|
@ -32,9 +32,18 @@
|
|||
},
|
||||
|
||||
loadPreview: function (model, $thumbnailDiv, $thumbnailContainer) {
|
||||
var handler = this.getPreviewHandler(model.get('mimetype'));
|
||||
var fallback = this.fallbackPreview.bind(this, model, $thumbnailDiv, $thumbnailContainer);
|
||||
handler(model, $thumbnailDiv, $thumbnailContainer, fallback);
|
||||
if (model.get('hasPreview') === false) {
|
||||
var mimeIcon = OC.MimeType.getIconUrl(model.get('mimetype'));
|
||||
$thumbnailDiv.removeClass('icon-loading icon-32');
|
||||
$thumbnailContainer.removeClass('image'); //fall back to regular view
|
||||
$thumbnailDiv.css({
|
||||
'background-image': 'url("' + mimeIcon + '")'
|
||||
});
|
||||
} else {
|
||||
var handler = this.getPreviewHandler(model.get('mimetype'));
|
||||
var fallback = this.fallbackPreview.bind(this, model, $thumbnailDiv, $thumbnailContainer);
|
||||
handler(model, $thumbnailDiv, $thumbnailContainer, fallback);
|
||||
}
|
||||
},
|
||||
|
||||
// previews for images and mimetype icons
|
||||
|
|
Loading…
Reference in New Issue