aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-11-27 21:34:19 +0100
committerVincent Petry <pvince81@owncloud.com>2013-11-27 21:35:00 +0100
commit68f610a90e496f95bec54dd97e992a01e34c61bc (patch)
tree86566ed62a403fecefc9901ed0ed0969be4ee33a /apps/files/js
parent43b1cf798839888e9e7266d80f55f6ce6f74d852 (diff)
downloadnextcloud-server-68f610a90e496f95bec54dd97e992a01e34c61bc.tar.gz
nextcloud-server-68f610a90e496f95bec54dd97e992a01e34c61bc.zip
Update file list entry on rename
Whenever a file is renamed, if the extension changes, the mime type and preview might change. This fix passes the updated info to the client that updates it.
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 66453740f5d..b8ae00ac494 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -422,12 +422,27 @@ var FileList={
}
tr.find('.fileactions').effect('highlight', {}, 5000);
tr.effect('highlight', {}, 5000);
+ // remove loading mark and recover old image
+ td.css('background-image', oldBackgroundImage);
+ }
+ else {
+ var fileInfo = result.data;
+ tr.attr('data-mime', fileInfo.mime);
+ tr.attr('data-etag', fileInfo.etag);
+ if (fileInfo.isPreviewAvailable) {
+ Files.lazyLoadPreview(fileInfo.directory + '/' + fileInfo.name, result.data.mime, function(previewpath) {
+ tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
+ }, null, null, result.data.etag);
+ }
+ else {
+ tr.find('td.filename').removeClass('preview').attr('style','background-image:url('+fileInfo.icon+')');
+ }
}
// reinsert row
tr.detach();
FileList.insertElement( tr.attr('data-file'), tr.attr('data-type'),tr );
- // remove loading mark and recover old image
- td.css('background-image', oldBackgroundImage);
+ // update file actions in case the extension changed
+ FileActions.display( tr.find('td.filename'), true);
}
});
}