Files
awx/awx/ui/static/js/shared/breadcrumbs/breadcrumbs.controller.js
2015-05-29 17:53:27 -04:00

42 lines
900 B
JavaScript

/*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
export default
[ '$scope',
'$rootScope',
function($scope, $rootScope) {
$scope.breadcrumbs = [];
this.addBreadcrumb = function(title, path, isCurrent) {
var breadcrumb =
{ title: title,
path: path,
isCurrent: isCurrent
};
if ($rootScope.enteredPath === path) {
breadcrumb.isCurrent = true;
}
$scope.breadcrumbs =
$scope.breadcrumbs.concat(breadcrumb);
return breadcrumb;
};
this.setHidden = function(hidden) {
if (angular.isUndefined(hidden)) {
$scope.isHidden = true;
} else {
$scope.isHidden = hidden;
}
};
}];