Start on new tag view
This commit is contained in:
parent
581a284744
commit
afc8e95e19
103 changed files with 148505 additions and 458 deletions
|
@ -13,7 +13,7 @@ angular.module('quay').directive('repoListGrid', function () {
|
|||
starred: '=starred',
|
||||
user: "=user",
|
||||
namespace: '=namespace',
|
||||
toggleStar: '&toggleStar'
|
||||
starToggled: '&starToggled'
|
||||
},
|
||||
controller: function($scope, $element, UserService) {
|
||||
$scope.isOrganization = function(namespace) {
|
||||
|
|
53
static/js/directives/ui/repo-star.js
Normal file
53
static/js/directives/ui/repo-star.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* An element that displays the star status of a repository and allows it to be toggled.
|
||||
*/
|
||||
angular.module('quay').directive('repoStar', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/repo-star.html',
|
||||
replace: false,
|
||||
transclude: true,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
repository: '=repository',
|
||||
starToggled: '&starToggled'
|
||||
},
|
||||
controller: function($scope, $element, UserService, ApiService) {
|
||||
// Star a repository or unstar a repository.
|
||||
$scope.toggleStar = function() {
|
||||
if ($scope.repository.is_starred) {
|
||||
unstarRepo();
|
||||
} else {
|
||||
starRepo();
|
||||
}
|
||||
};
|
||||
|
||||
// Star a repository and update the UI.
|
||||
var starRepo = function() {
|
||||
var data = {
|
||||
'namespace': $scope.repository.namespace,
|
||||
'repository': $scope.repository.name
|
||||
};
|
||||
|
||||
ApiService.createStar(data).then(function(result) {
|
||||
$scope.repository.is_starred = true;
|
||||
$scope.starToggled({'repository': $scope.repository});
|
||||
}, ApiService.errorDisplay('Could not star repository'));
|
||||
};
|
||||
|
||||
// Unstar a repository and update the UI.
|
||||
var unstarRepo = function(repo) {
|
||||
var data = {
|
||||
'repository': $scope.repository.namespace + '/' + $scope.repository.name
|
||||
};
|
||||
|
||||
ApiService.deleteStar(null, data).then(function(result) {
|
||||
$scope.repository.is_starred = false;
|
||||
$scope.starToggled({'repository': $scope.repository});
|
||||
}, ApiService.errorDisplay('Could not unstar repository'));
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return directiveDefinitionObject;
|
||||
});
|
|
@ -27,7 +27,7 @@ angular.module('quay').directive('resourceView', function () {
|
|||
return 'loading';
|
||||
}
|
||||
|
||||
if (current.error) {
|
||||
if (current.hasError) {
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue