diff --git a/static/js/pages/org-view.js b/static/js/pages/org-view.js index 0f33e9d92..1238f75e9 100644 --- a/static/js/pages/org-view.js +++ b/static/js/pages/org-view.js @@ -13,16 +13,20 @@ }, ['old-layout']); }]); - function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService) { + function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService, AvatarService) { var orgname = $routeParams.orgname; $scope.showLogsCounter = 0; $scope.showApplicationsCounter = 0; $scope.showInvoicesCounter = 0; - $scope.changingOrganization = false; - $scope.$watch('organizationEmail', function(e) { - UIService.hidePopover('#changeEmailForm'); + $scope.orgScope = { + 'changingOrganization': false, + 'organizationEmail': '' + }; + + $scope.$watch('orgScope.organizationEmail', function(e) { + UIService.hidePopover('#changeEmailForm input'); }); var loadRepositories = function() { @@ -41,7 +45,7 @@ var loadOrganization = function() { $scope.orgResource = ApiService.getOrganizationAsResource({'orgname': orgname}).get(function(org) { $scope.organization = org; - $scope.organizationEmail = org.email; + $scope.orgScope.organizationEmail = org.email; $scope.isAdmin = org.is_admin; $scope.isMember = org.is_member; @@ -68,24 +72,23 @@ }; $scope.changeEmail = function() { - UIService.hidePopover('#changeEmailForm'); + UIService.hidePopover('#changeEmailForm input'); - $scope.changingOrganization = true; + $scope.orgScope.changingOrganization = true; var params = { 'orgname': orgname }; var data = { - 'email': $scope.organizationEmail + 'email': $scope.orgScope.organizationEmail }; ApiService.changeOrganizationDetails(data, params).then(function(org) { - $scope.changingOrganization = false; - $scope.changeEmailForm.$setPristine(); + $scope.orgScope.changingOrganization = false; $scope.organization = org; }, function(result) { - $scope.changingOrganization = false; - UIService.showFormError('#changeEmailForm', result); + $scope.orgScope.changingOrganization = false; + UIService.showFormError('#changeEmailForm input', result, 'right'); }); }; } diff --git a/static/js/services/ui-service.js b/static/js/services/ui-service.js index 2e857e8fa..2b96634f3 100644 --- a/static/js/services/ui-service.js +++ b/static/js/services/ui-service.js @@ -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'); if (!popover) { - $(elem).popover({'content': '-', 'placement': 'left'}); + $(elem).popover({'content': '-', 'placement': opt_placement || 'left'}); } setTimeout(function() { @@ -79,10 +79,10 @@ angular.module('quay').factory('UIService', [function() { }, 500); }; - uiService.showFormError = function(elem, result) { + uiService.showFormError = function(elem, result, opt_placement) { var message = result.data['message'] || result.data['error_description'] || ''; if (message) { - uiService.showPopover(elem, message); + uiService.showPopover(elem, message, opt_placement); } else { uiService.hidePopover(elem); } diff --git a/static/partials/org-view.html b/static/partials/org-view.html index 6fb5995b4..25f062795 100644 --- a/static/partials/org-view.html +++ b/static/partials/org-view.html @@ -105,15 +105,14 @@

Organization Settings

-
+
Organization's e-mail address
-
- - -