Make the repo breadcrumb bar clickable

This commit is contained in:
Joseph Schorr 2014-01-31 13:52:35 -05:00
parent 0e2adf7a30
commit fdb628a0b0
6 changed files with 72 additions and 7 deletions

View file

@ -384,6 +384,15 @@ quayApp = angular.module('quay', ['ngRoute', 'chieffancypants.loadingBar', 'rest
return org.is_org_admin;
};
userService.isKnownNamespace = function(namespace) {
if (namespace == userResponse.username) {
return true;
}
var org = userService.getOrganization(namespace);
return !!org;
};
userService.currentUser = function() {
return userResponse;
@ -854,6 +863,32 @@ quayApp.directive('markdownView', function () {
});
quayApp.directive('repoBreadcrumb', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/repo-breadcrumb.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {
'repo': '=repo',
'image': '=image'
},
controller: function($scope, $element, $location, UserService, CookieService) {
$scope.showNamespace = function() {
var namespace = $scope.repo.namespace || '';
if (UserService.isKnownNamespace(namespace)) {
CookieService.putPermanent('quay.namespace', namespace);
}
$location.path('/repository/');
};
}
};
return directiveDefinitionObject;
});
quayApp.directive('repoCircle', function () {
var directiveDefinitionObject = {
priority: 0,