summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-11-23 11:21:47 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-11-26 14:28:45 +0100
commitc2f4297e49f17922a54ebc2d9ffdb7df9d641fb6 (patch)
tree9bbdfacbad1e2840976380ef3de8e7dc4bd0dab2 /apps/files_versions
parent15a04ecaeb0c6b284bb706fee78bb40518b03fab (diff)
downloadnextcloud-server-c2f4297e49f17922a54ebc2d9ffdb7df9d641fb6.tar.gz
nextcloud-server-c2f4297e49f17922a54ebc2d9ffdb7df9d641fb6.zip
Show mimetype icon if version preview is not available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/js/versionstabview.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/files_versions/js/versionstabview.js b/apps/files_versions/js/versionstabview.js
index a9470ad8393..12b493beec0 100644
--- a/apps/files_versions/js/versionstabview.js
+++ b/apps/files_versions/js/versionstabview.js
@@ -150,6 +150,12 @@
_formatItem: function(version) {
var timestamp = version.get('timestamp') * 1000;
var size = version.has('size') ? version.get('size') : 0;
+ var preview = OC.MimeType.getIconUrl(version.get('mimetype'));
+ var img = new Image();
+ img.onload = function () {
+ $('li[data-revision=' + version.get('timestamp') + '] .preview').attr('src', version.getPreviewUrl());
+ };
+ img.src = version.getPreviewUrl();
return _.extend({
versionId: version.get('id'),
@@ -163,7 +169,7 @@
downloadIconUrl: OC.imagePath('core', 'actions/download'),
downloadName: version.get('name'),
revertIconUrl: OC.imagePath('core', 'actions/history'),
- previewUrl: version.getPreviewUrl(),
+ previewUrl: preview,
revertLabel: t('files_versions', 'Restore'),
canRevert: (this.collection.getFileInfo().get('permissions') & OC.PERMISSION_UPDATE) !== 0
}, version.attributes);