summaryrefslogtreecommitdiffstats
path: root/apps/files
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
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')
-rw-r--r--apps/files/js/filelist.js6
-rw-r--r--apps/files/js/sidebarpreviewmanager.js15
2 files changed, 16 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 6ac72d8c169..f50322953d2 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -857,7 +857,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) {
@@ -1073,7 +1074,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) {
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