Просмотр исходного кода

HUE-4689 [fb] D&D a file into a directory in S3 gets 'RenameFormFormSet' object has no attribute 'data'

Enrico Berti 9 лет назад
Родитель
Сommit
1fa14f68c5

+ 9 - 3
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -624,7 +624,7 @@ from django.utils.translation import ugettext as _
 
               if (destpath) {
                 $('#moveDestination').val(destpath);
-                viewModel.move('nomodal');
+                viewModel.move('nomodal', _dragged);
               }
             }
           };
@@ -1194,7 +1194,7 @@ from django.utils.translation import ugettext as _
         });
       };
 
-      self.move = function (mode) {
+      self.move = function (mode, unselectedDrag) {
         var paths = [];
 
         var isMoveOnSelf = false;
@@ -1205,6 +1205,10 @@ from django.utils.translation import ugettext as _
           paths.push(file.path);
         });
 
+        if (paths.length == 0 && typeof unselectedDrag !== 'undefined'){
+          paths.push(_dragged.path);
+        }
+
         if (!isMoveOnSelf){
           hiddenFields($("#moveForm"), "src_path", paths);
 
@@ -1579,7 +1583,9 @@ from django.utils.translation import ugettext as _
       // Place all values into hidden fields under parent element.
       // Looks for managed hidden fields and handles sizing appropriately.
       var hiddenFields = function (parentEl, name, values) {
-        parentEl = $(parentEl);
+        if (!(parentEl instanceof jQuery)){
+          parentEl = $(parentEl);
+        }
         parentEl.find("input.hidden-field").remove();
 
         $(values).each(function (index, value) {