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) {
"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) {
},
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