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'),
|
type: $el.attr('data-type'),
|
||||||
size: parseInt($el.attr('data-size'), 10),
|
size: parseInt($el.attr('data-size'), 10),
|
||||||
etag: $el.attr('data-etag'),
|
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');
|
var icon = $el.attr('data-icon');
|
||||||
if (icon) {
|
if (icon) {
|
||||||
|
@ -1068,7 +1069,8 @@
|
||||||
"data-mime": mime,
|
"data-mime": mime,
|
||||||
"data-mtime": mtime,
|
"data-mtime": mtime,
|
||||||
"data-etag": fileData.etag,
|
"data-etag": fileData.etag,
|
||||||
"data-permissions": fileData.permissions || this.getDirectoryPermissions()
|
"data-permissions": fileData.permissions || this.getDirectoryPermissions(),
|
||||||
|
"data-has-preview": fileData.hasPreview !== false
|
||||||
});
|
});
|
||||||
|
|
||||||
if (dataIcon) {
|
if (dataIcon) {
|
||||||
|
|
|
@ -32,9 +32,18 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
loadPreview: function (model, $thumbnailDiv, $thumbnailContainer) {
|
loadPreview: function (model, $thumbnailDiv, $thumbnailContainer) {
|
||||||
var handler = this.getPreviewHandler(model.get('mimetype'));
|
if (model.get('hasPreview') === false) {
|
||||||
var fallback = this.fallbackPreview.bind(this, model, $thumbnailDiv, $thumbnailContainer);
|
var mimeIcon = OC.MimeType.getIconUrl(model.get('mimetype'));
|
||||||
handler(model, $thumbnailDiv, $thumbnailContainer, fallback);
|
$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
|
// previews for images and mimetype icons
|
||||||
|
|
Loading…
Reference in New Issue