]> source.dussan.org Git - nextcloud-server.git/commitdiff
File actions are now updated after create/upload file
authorVincent Petry <pvince81@owncloud.com>
Fri, 11 Oct 2013 15:06:01 +0000 (17:06 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 11 Oct 2013 15:07:48 +0000 (17:07 +0200)
The file actions must explicitly be updated by calling
FileActions.display() on the file element after creating or uploading a
file.

Fixes #4971 and #4993

apps/files/js/file-upload.js

index f1ef485fc3d77eb99ea6e4a703daf9ba54f2bb00..fbb53b3530afec1988c34b7d9bb4b9ca387c471c 100644 (file)
@@ -523,8 +523,10 @@ $(document).ready(function() {
                                                function(result){
                                                        if (result.status == 'success') {
                                                                var date=new Date();
-                                                               FileList.addFile(name,0,date,false,hidden);
-                                                               var tr=$('tr').filterAttr('data-file',name);
+                                                               // TODO: ideally addFile should be able to receive
+                                                               // all attributes and set them automatically,
+                                                               // and also auto-load the preview
+                                                               var tr = FileList.addFile(name,0,date,false,hidden);
                                                                tr.attr('data-size',result.data.size);
                                                                tr.attr('data-mime',result.data.mime);
                                                                tr.attr('data-id', result.data.id);
@@ -533,6 +535,7 @@ $(document).ready(function() {
                                                                lazyLoadPreview(path, result.data.mime, function(previewpath){
                                                                        tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
                                                                });
+                                                               FileActions.display(tr.find('td.filename'));
                                                        } else {
                                                                OC.dialogs.alert(result.data.message, t('core', 'Error'));
                                                        }