]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix breadcrumb to reinit dnd after ajax nav #5064
authorVincent Petry <pvince81@owncloud.com>
Mon, 7 Oct 2013 09:07:33 +0000 (11:07 +0200)
committerVincent Petry <pvince81@owncloud.com>
Mon, 7 Oct 2013 09:07:33 +0000 (11:07 +0200)
Now correctly reinitializing the breadcrumb drop zone after ajax
navigation.

This also fixes dropping onto the "files" app icon.

apps/files/js/files.js

index 899bc6469e503a74bf8b99a2bc7381ca5e169878..53858d65c659d068c8153c9d5d78dfd9a5de1131 100644 (file)
@@ -98,6 +98,8 @@ Files={
        lastWidth: 0,
 
        initBreadCrumbs: function () {
+               var $controls = $('#controls');
+
                Files.lastWidth = 0;
                Files.breadcrumbs = [];
 
@@ -118,7 +120,10 @@ Files={
                });
 
                // event handlers for breadcrumb items
-               $('#controls .crumb a').on('click', onClickBreadcrumb);
+               $controls.find('.crumb a').on('click', onClickBreadcrumb);
+
+               // setup drag and drop
+               $controls.find('.crumb:not(.last)').droppable(crumbDropOptions);
        },
 
        resizeBreadcrumbs: function (width, firstRun) {
@@ -176,11 +181,8 @@ $(document).ready(function() {
 
        $('#file_action_panel').attr('activeAction', false);
 
-       $('div.crumb:not(.last)').droppable(crumbDropOptions);
-       $('ul#apps>li:first-child').data('dir','');
-       if($('div.crumb').length){
-               $('ul#apps>li:first-child').droppable(crumbDropOptions);
-       }
+       // allow dropping on the "files" app icon
+       $('ul#apps li:first-child').data('dir','').droppable(crumbDropOptions);
 
        // Triggers invisible file input
        $('#upload a').on('click', function() {