Add support for org-based subscriptions
This commit is contained in:
parent
97a7cd23e7
commit
e356a10378
5 changed files with 109 additions and 35 deletions
|
@ -31,6 +31,17 @@ function getFirstTextLine(commentString) {
|
|||
return '';
|
||||
}
|
||||
|
||||
function getRestUrl(args) {
|
||||
var url = '';
|
||||
for (var i = 0; i < arguments.length; ++i) {
|
||||
if (i > 0) {
|
||||
url += '/';
|
||||
}
|
||||
url += encodeURI(arguments[i])
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
function getMarkedDown(string) {
|
||||
return Markdown.getSanitizingConverter().makeHtml(string || '');
|
||||
}
|
||||
|
@ -160,7 +171,7 @@ quayApp = angular.module('quay', ['restangular', 'angularMoment', 'angulartics',
|
|||
});
|
||||
};
|
||||
|
||||
planService.showSubscribeDialog = function($scope, planId, started, success, failed) {
|
||||
planService.showSubscribeDialog = function($scope, planId, orgname, started, success, failed) {
|
||||
var submitToken = function(token) {
|
||||
$scope.$apply(function() {
|
||||
started();
|
||||
|
@ -173,7 +184,8 @@ quayApp = angular.module('quay', ['restangular', 'angularMoment', 'angulartics',
|
|||
plan: planId,
|
||||
};
|
||||
|
||||
var createSubscriptionRequest = Restangular.one('user/plan');
|
||||
var url = orgname ? getRestUrl('organization', orgname, 'plan') : 'user/plan';
|
||||
var createSubscriptionRequest = Restangular.one(url);
|
||||
$scope.$apply(function() {
|
||||
createSubscriptionRequest.customPUT(subscriptionDetails).then(success, failed);
|
||||
});
|
||||
|
|
Reference in a new issue