summaryrefslogtreecommitdiffstats
path: root/apps/files/js/sidebarpreviewmanager.js
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-07-26 13:51:18 +0200
committerRobin Appelman <robin@icewind.nl>2016-07-27 12:59:43 +0200
commit6368506e5735e2bee4c1ae7280ee2bafacfaccd7 (patch)
tree5d41490a80f24906b7cd0c3afa635492f1fc0ef5 /apps/files/js/sidebarpreviewmanager.js
parent03c17ff614ba9cd022a7c855b63516adfb6f5055 (diff)
downloadnextcloud-server-6368506e5735e2bee4c1ae7280ee2bafacfaccd7.tar.gz
nextcloud-server-6368506e5735e2bee4c1ae7280ee2bafacfaccd7.zip
only load sidebar previews when we know it's available
Diffstat (limited to 'apps/files/js/sidebarpreviewmanager.js')
-rw-r--r--apps/files/js/sidebarpreviewmanager.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/files/js/sidebarpreviewmanager.js b/apps/files/js/sidebarpreviewmanager.js
index cfd1fffae13..3d540119189 100644
--- a/apps/files/js/sidebarpreviewmanager.js
+++ b/apps/files/js/sidebarpreviewmanager.js
@@ -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