Start on new tag view

This commit is contained in:
Joseph Schorr 2015-03-09 22:03:39 -07:00
parent 581a284744
commit afc8e95e19
103 changed files with 148505 additions and 458 deletions

View file

@ -52,38 +52,14 @@
return !!UserService.getOrganization(namespace);
};
// Star a repository or unstar a repository.
$scope.toggleStar = function(repo) {
$scope.starToggled = function(repo) {
if (repo.is_starred) {
unstarRepo(repo);
} else {
starRepo(repo);
}
}
// Star a repository and update the UI.
var starRepo = function(repo) {
var data = {
'namespace': repo.namespace,
'repository': repo.name
};
ApiService.createStar(data).then(function(result) {
repo.is_starred = true;
$scope.starred_repositories.value.push(repo);
}, ApiService.errorDisplay('Could not star repository'));
};
// Unstar a repository and update the UI.
var unstarRepo = function(repo) {
var data = {
'repository': repo.namespace + '/' + repo.name
};
ApiService.deleteStar(null, data).then(function(result) {
repo.is_starred = false;
} else {
$scope.starred_repositories.value = $scope.starred_repositories.value.filter(function(repo) {
return repo.is_starred;
});
}, ApiService.errorDisplay('Could not unstar repository'));
}
};
// Finds a duplicate repo if it exists. If it doesn't, inserts the repo.