Finish up create team
This commit is contained in:
parent
a3970fa75c
commit
237614dcef
6 changed files with 101 additions and 12 deletions
|
@ -569,6 +569,15 @@ quayApp.directive('buildStatus', function () {
|
|||
return directiveDefinitionObject;
|
||||
});
|
||||
|
||||
// Note: ngBlur is not yet in Angular stable, so we add it manaully here.
|
||||
quayApp.directive('ngBlur', function() {
|
||||
return function( scope, elem, attrs ) {
|
||||
elem.bind('blur', function() {
|
||||
scope.$apply(attrs.ngBlur);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
quayApp.run(['$location', '$rootScope', function($location, $rootScope) {
|
||||
$rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
|
||||
if (current.$$route.title) {
|
||||
|
|
|
@ -1122,6 +1122,41 @@ function OrgViewCtrl($rootScope, $scope, Restangular, $routeParams) {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.createTeamShown = function() {
|
||||
setTimeout(function() {
|
||||
$('#create-team-box').focus();
|
||||
}, 10);
|
||||
};
|
||||
|
||||
$scope.createTeam = function() {
|
||||
var box = $('#create-team-box');
|
||||
if (box.hasClass('ng-invalid')) { return; }
|
||||
|
||||
var teamname = box[0].value.toLowerCase();
|
||||
if (!teamname) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($scope.organization.teams[teamname]) {
|
||||
$('#team-' + teamname).removeClass('highlight');
|
||||
setTimeout(function() {
|
||||
$('#team-' + teamname).addClass('highlight');
|
||||
}, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
var createTeam = Restangular.one(getRestUrl('organization', orgname, 'team', teamname));
|
||||
var data = {
|
||||
'name': teamname,
|
||||
'role': 'member'
|
||||
};
|
||||
createTeam.customPOST(data).then(function(resp) {
|
||||
$scope.organization.teams[teamname] = resp;
|
||||
}, function() {
|
||||
$('#cannotChangeTeamModal').modal({});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.askDeleteTeam = function(teamname) {
|
||||
$scope.currentDeleteTeam = teamname;
|
||||
$('#confirmdeleteModal').modal({});
|
||||
|
|
Reference in a new issue