diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index 6e8c1d7..98bcabd 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -441,6 +441,7 @@ app.controller('websiteCtrl', [ }; vm.getDirectoriesFromBreadcrumbs = function (dir) { + vm.isRoot = false; if (vm.copyR.shareAccess.path !== '/') { var strictArray = vm.copyR.shareAccess.path.split('/'); if (vm.breadcrumbsPath.join('/') === '') { @@ -463,11 +464,20 @@ app.controller('websiteCtrl', [ vm.breadcrumbsPath = breadcrumblies.split('/'); vm.breadcrumbs.push(dir); } else { - if (vm.copyR.shareAccess.path !== '/') { - vm.breadcrumbsPath.push(dir); - vm.breadcrumbs.push(dir); + if (vm.copyR.shareAccess.path !== '/' && vm.copyR.newFile) { + if (vm.count === 1) { + vm.breadcrumbsPath.push(dir); + vm.breadcrumbs.push(dir); + } else { + if (vm.isRoot) { + vm.breadcrumbsPath.pop(); + } + vm.breadcrumbsPath.push(dir); + vm.breadcrumbs.push(dir); + } } else { vm.breadcrumbsPath.push(dir); + vm.breadcrumbs.push(dir); } } vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/')); @@ -478,6 +488,7 @@ app.controller('websiteCtrl', [ vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/')); } vm.currentFolder = vm.breadcrumbs[vm.breadcrumbs.length - 1]; + console.log(vm.breadcrumbsPath.join('/')); }; vm.removeAllFiles = function (r, opts) { @@ -512,7 +523,6 @@ app.controller('websiteCtrl', [ requestedPath = vm.breadcrumbsPath.join('/') + '/' + file; } } - requestedPath = cleanPathQuery(requestedPath); opts = { path: requestedPath }; @@ -553,6 +563,8 @@ app.controller('websiteCtrl', [ var removeFolder = vm.previousSearchQuery.split('/'); removeFolder.pop(); vm.previousSearchQuery = removeFolder.join('/'); + vm.breadcrumbs.pop(); + vm.breadcrumbsPath.pop(); vm.Sites.contents(vm.copyR, vm.previousSearchQuery); } else { vm.Sites.contents(vm.copyR, vm.previousSearchQuery); @@ -616,6 +628,8 @@ app.controller('websiteCtrl', [ } }; + vm.count = 0; + vm.isRoot = true; vm.Sites.upload = function (r) { var pkg = Auth.oauth3.pkg('www@daplie.com'); //analyzeFile(r.newFile, r); @@ -641,6 +655,9 @@ app.controller('websiteCtrl', [ r.uploadPath = cleanPathQuery(r.uploadPath); } } + if (vm.copyR.newFile) { + vm.copyR.fAmount = vm.count++; + } vm._uploadFile(pkg, r); };