2013-09-26 23:59:58 +00:00
|
|
|
function HeaderCtrl($scope, UserService) {
|
|
|
|
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
|
|
|
|
$scope.user = currentUser;
|
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
|
2013-09-24 22:21:14 +00:00
|
|
|
function RepoListCtrl($scope, Restangular) {
|
|
|
|
var repositoryFetch = Restangular.all('repository/');
|
|
|
|
repositoryFetch.getList().then(function(resp) {
|
|
|
|
$scope.repositories = resp.repositories;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function LandingCtrl($scope) {
|
|
|
|
|
|
|
|
}
|
2013-09-26 21:59:20 +00:00
|
|
|
|
|
|
|
function RepoCtrl($scope, Restangular, $routeParams, $rootScope) {
|
|
|
|
$rootScope.title = 'Loading...';
|
|
|
|
|
|
|
|
$scope.editDescription = function() {
|
2013-09-26 23:07:25 +00:00
|
|
|
if (!$scope.repo.can_write) { return; }
|
|
|
|
$('#descriptionEdit')[0].value = $scope.repo.description || '';
|
|
|
|
$('#editModal').modal({});
|
2013-09-26 21:59:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
$scope.saveDescription = function() {
|
2013-09-26 23:07:25 +00:00
|
|
|
$('#editModal').modal('hide');
|
|
|
|
$scope.repo.description = $('#descriptionEdit')[0].value;
|
|
|
|
$scope.repo.put();
|
2013-09-26 21:59:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var namespace = $routeParams.namespace;
|
|
|
|
var name = $routeParams.name;
|
|
|
|
var tag = $routeParams.tag || 'latest';
|
|
|
|
|
|
|
|
var repositoryFetch = Restangular.one('repository/' + namespace + '/' + name);
|
|
|
|
repositoryFetch.get().then(function(repo) {
|
2013-09-26 23:07:25 +00:00
|
|
|
$rootScope.title = namespace + '/' + name;
|
|
|
|
$scope.repo = repo;
|
|
|
|
$scope.currentTag = repo.tags[tag] || repo.tags['latest'];
|
2013-09-26 21:59:20 +00:00
|
|
|
}, function() {
|
2013-09-26 23:07:25 +00:00
|
|
|
$scope.repo = null;
|
|
|
|
$rootScope.title = 'Unknown Repository';
|
2013-09-26 21:59:20 +00:00
|
|
|
});
|
2013-09-26 23:59:58 +00:00
|
|
|
}
|
2013-09-27 00:34:58 +00:00
|
|
|
|
|
|
|
function RepoAdminCtrl() {
|
|
|
|
|
|
|
|
}
|