GUAC-1172: Implement navigation via breadcrumbs - no more tree.

This commit is contained in:
Michael Jumper
2015-07-01 15:47:01 -07:00
parent c673de30e1
commit 149fba6737
8 changed files with 131 additions and 38 deletions

View File

@@ -28,6 +28,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
// Required types
var ManagedClientState = $injector.get('ManagedClientState');
var ManagedFilesystem = $injector.get('ManagedFilesystem');
var ScrollState = $injector.get('ScrollState');
// Required services
@@ -595,6 +596,45 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
return !!$scope.filesystemMenuContents && $scope.menu.shown;
};
/**
* Returns the full path to the given file as an ordered array of parent
* directories.
*
* @param {ManagedFilesystem.File} file
* The file whose full path should be retrieved.
*
* @returns {ManagedFilesystem.File[]}
* An array of directories which make up the hierarchy containing the
* given file, in order of increasing depth.
*/
$scope.getPath = function getPath(file) {
var path = [];
// Add all files to path in ascending order of depth
while (file && file.parent) {
path.unshift(file);
file = file.parent;
}
return path;
};
/**
* Changes the current directory of the given filesystem to the given
* directory.
*
* @param {ManagedFilesystem} filesystem
* The filesystem whose current directory should be changed.
*
* @param {ManagedFilesystem.File} file
* The directory to change to.
*/
$scope.changeDirectory = function changeDirectory(filesystem, file) {
ManagedFilesystem.changeDirectory(filesystem, file);
};
// Clean up when view destroyed
$scope.$on('$destroy', function clientViewDestroyed() {