Fix change org email tab
This commit is contained in:
parent
27a9b84587
commit
805af1c0c0
3 changed files with 25 additions and 23 deletions
|
@ -13,16 +13,20 @@
|
||||||
}, ['old-layout']);
|
}, ['old-layout']);
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService) {
|
function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService, AvatarService) {
|
||||||
var orgname = $routeParams.orgname;
|
var orgname = $routeParams.orgname;
|
||||||
|
|
||||||
$scope.showLogsCounter = 0;
|
$scope.showLogsCounter = 0;
|
||||||
$scope.showApplicationsCounter = 0;
|
$scope.showApplicationsCounter = 0;
|
||||||
$scope.showInvoicesCounter = 0;
|
$scope.showInvoicesCounter = 0;
|
||||||
$scope.changingOrganization = false;
|
|
||||||
|
|
||||||
$scope.$watch('organizationEmail', function(e) {
|
$scope.orgScope = {
|
||||||
UIService.hidePopover('#changeEmailForm');
|
'changingOrganization': false,
|
||||||
|
'organizationEmail': ''
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$watch('orgScope.organizationEmail', function(e) {
|
||||||
|
UIService.hidePopover('#changeEmailForm input');
|
||||||
});
|
});
|
||||||
|
|
||||||
var loadRepositories = function() {
|
var loadRepositories = function() {
|
||||||
|
@ -41,7 +45,7 @@
|
||||||
var loadOrganization = function() {
|
var loadOrganization = function() {
|
||||||
$scope.orgResource = ApiService.getOrganizationAsResource({'orgname': orgname}).get(function(org) {
|
$scope.orgResource = ApiService.getOrganizationAsResource({'orgname': orgname}).get(function(org) {
|
||||||
$scope.organization = org;
|
$scope.organization = org;
|
||||||
$scope.organizationEmail = org.email;
|
$scope.orgScope.organizationEmail = org.email;
|
||||||
$scope.isAdmin = org.is_admin;
|
$scope.isAdmin = org.is_admin;
|
||||||
$scope.isMember = org.is_member;
|
$scope.isMember = org.is_member;
|
||||||
|
|
||||||
|
@ -68,24 +72,23 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.changeEmail = function() {
|
$scope.changeEmail = function() {
|
||||||
UIService.hidePopover('#changeEmailForm');
|
UIService.hidePopover('#changeEmailForm input');
|
||||||
|
|
||||||
$scope.changingOrganization = true;
|
$scope.orgScope.changingOrganization = true;
|
||||||
var params = {
|
var params = {
|
||||||
'orgname': orgname
|
'orgname': orgname
|
||||||
};
|
};
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
'email': $scope.organizationEmail
|
'email': $scope.orgScope.organizationEmail
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiService.changeOrganizationDetails(data, params).then(function(org) {
|
ApiService.changeOrganizationDetails(data, params).then(function(org) {
|
||||||
$scope.changingOrganization = false;
|
$scope.orgScope.changingOrganization = false;
|
||||||
$scope.changeEmailForm.$setPristine();
|
|
||||||
$scope.organization = org;
|
$scope.organization = org;
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
$scope.changingOrganization = false;
|
$scope.orgScope.changingOrganization = false;
|
||||||
UIService.showFormError('#changeEmailForm', result);
|
UIService.showFormError('#changeEmailForm input', result, 'right');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,10 +66,10 @@ angular.module('quay').factory('UIService', [function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
uiService.showPopover = function(elem, content) {
|
uiService.showPopover = function(elem, content, opt_placement) {
|
||||||
var popover = $(elem).data('bs.popover');
|
var popover = $(elem).data('bs.popover');
|
||||||
if (!popover) {
|
if (!popover) {
|
||||||
$(elem).popover({'content': '-', 'placement': 'left'});
|
$(elem).popover({'content': '-', 'placement': opt_placement || 'left'});
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
@ -79,10 +79,10 @@ angular.module('quay').factory('UIService', [function() {
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
uiService.showFormError = function(elem, result) {
|
uiService.showFormError = function(elem, result, opt_placement) {
|
||||||
var message = result.data['message'] || result.data['error_description'] || '';
|
var message = result.data['message'] || result.data['error_description'] || '';
|
||||||
if (message) {
|
if (message) {
|
||||||
uiService.showPopover(elem, message);
|
uiService.showPopover(elem, message, opt_placement);
|
||||||
} else {
|
} else {
|
||||||
uiService.hidePopover(elem);
|
uiService.hidePopover(elem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,15 +105,14 @@
|
||||||
<h3>Organization Settings</h3>
|
<h3>Organization Settings</h3>
|
||||||
|
|
||||||
|
|
||||||
<div class="panel" ng-show="!changingOrganization">
|
<div class="panel" ng-show="!orgScope.changingOrganization">
|
||||||
<div class="panel-title">Organization's e-mail address</div>
|
<div class="panel-title">Organization's e-mail address</div>
|
||||||
<div class="panel-content" style="padding-left: 20px; margin-top: 10px;">
|
<div class="panel-content" style="padding-left: 20px; margin-top: 10px;">
|
||||||
<form class="form-change" id="changeEmailForm" name="changeEmailForm" ng-submit="changeEmail()" data-trigger="manual"
|
<form class="form-change" id="changeEmailForm" name="changeEmailForm" ng-submit="changeEmail()">
|
||||||
data-content="{{ changeEmailError }}" data-placement="bottom" ng-show="!updatingOrganization">
|
<input type="email" class="form-control" style="max-width: 500px;"
|
||||||
<span class="avatar" size="24" email="organizationEmail" name="orgname"></span>
|
ng-model="orgScope.organizationEmail" required>
|
||||||
<input type="email" class="form-control" ng-model="organizationEmail"
|
<button class="btn btn-primary" type="submit"
|
||||||
style="margin-left: 10px; margin-right: 10px; width: 400px; display: inline-block;" required>
|
ng-disabled="changeEmailForm.$invalid || orgScope.organizationEmail == organization.email">
|
||||||
<button class="btn btn-primary" type="submit" ng-disabled="changeEmailForm.$invalid || organizationEmail == organization.email">
|
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
Reference in a new issue