Add receipt/invoice email support and option to Quay

This commit is contained in:
Joseph Schorr 2013-11-15 14:42:31 -05:00
parent 318dc79de3
commit 457b619647
14 changed files with 310 additions and 32 deletions

View file

@ -621,6 +621,52 @@ quayApp.directive('roleGroup', function () {
});
quayApp.directive('billingOptions', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/billing-options.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {
'user': '=user',
'organization': '=organization'
},
controller: function($scope, $element, Restangular) {
$scope.invoice_email = false;
var update = function() {
if (!$scope.user && !$scope.organization) { return; }
$scope.obj = $scope.user ? $scope.user : $scope.organization;
$scope.invoice_email = $scope.obj.invoice_email;
};
var save = function() {
$scope.working = true;
var url = $scope.organization ? getRestUrl('organization', $scope.organization.name) : 'user/';
var conductSave = Restangular.one(url);
conductSave.customPUT($scope.obj).then(function(resp) {
$scope.working = false;
});
};
var checkSave = function() {
if (!$scope.obj) { return; }
if ($scope.obj.invoice_email != $scope.invoice_email) {
$scope.obj.invoice_email = $scope.invoice_email;
save();
}
};
$scope.$watch('invoice_email', checkSave);
$scope.$watch('organization', update);
$scope.$watch('user', update);
}
};
return directiveDefinitionObject;
});
quayApp.directive('planManager', function () {
var directiveDefinitionObject = {
priority: 0,