Add breadcrumb to filemanager

This commit is contained in:
Johannes Zellner
2020-07-10 15:01:56 +02:00
parent 4ebaa674c3
commit 2cecdd7f01
2 changed files with 25 additions and 20 deletions

View File

@@ -22,6 +22,7 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
$scope.initialized = false;
$scope.client = Client;
$scope.cwd = '/';
$scope.cwdParts = [];
$scope.appId = search.appId;
$scope.app = null;
$scope.entries = [];
@@ -73,12 +74,17 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
setDirectory($scope.cwd + '/..');
};
$scope.changeDirectory = function (path) {
setDirectory(path);
};
function setDirectory(path) {
path = sanitize(path);
if ($scope.cwd === path) return;
$scope.cwd = path;
$scope.cwdParts = path.split('/').filter(function (p) { return !!p; }).map(function (p, i) { return { name: p, path: path.split('/').slice(0, i+2).join('/') }; });
$scope.refresh();
}