Have the org plans on the plans page link to new organization, with the selected plan, well… selected :)
This commit is contained in:
parent
d45de5a8dd
commit
a7415ef4d3
3 changed files with 21 additions and 5 deletions
|
@ -648,16 +648,17 @@ quayApp.directive('planManager', function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadPlans = function() {
|
var loadPlans = function() {
|
||||||
if ($scope.plans) { return; }
|
if ($scope.plans || $scope.loadingPlans) { return; }
|
||||||
if (!$scope.user && !$scope.organization) { return; }
|
if (!$scope.user && !$scope.organization) { return; }
|
||||||
|
|
||||||
|
$scope.loadingPlans = true;
|
||||||
PlanService.getPlans(function(plans) {
|
PlanService.getPlans(function(plans) {
|
||||||
$scope.plans = plans[$scope.organization ? 'business' : 'user'];
|
$scope.plans = plans[$scope.organization ? 'business' : 'user'];
|
||||||
update();
|
update();
|
||||||
|
|
||||||
if ($scope.readyForPlan) {
|
if ($scope.readyForPlan) {
|
||||||
var planRequested = $scope.readyForPlan();
|
var planRequested = $scope.readyForPlan();
|
||||||
if (planRequested) {
|
if (planRequested && planRequested != getFreePlan()) {
|
||||||
$scope.changeSubscription(planRequested);
|
$scope.changeSubscription(planRequested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ function SigninCtrl($scope, $location, $timeout, Restangular, KeyService, UserSe
|
||||||
$scope.status = 'ready';
|
$scope.status = 'ready';
|
||||||
};
|
};
|
||||||
|
|
||||||
function PlansCtrl($scope, UserService, PlanService) {
|
function PlansCtrl($scope, $location, UserService, PlanService) {
|
||||||
// Load the list of plans.
|
// Load the list of plans.
|
||||||
PlanService.getPlans(function(plans) {
|
PlanService.getPlans(function(plans) {
|
||||||
$scope.plans = plans;
|
$scope.plans = plans;
|
||||||
|
@ -107,6 +107,14 @@ function PlansCtrl($scope, UserService, PlanService) {
|
||||||
$('#signinModal').modal({});
|
$('#signinModal').modal({});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.createOrg = function(plan) {
|
||||||
|
if ($scope.user && !$scope.user.anonymous) {
|
||||||
|
document.location = '/organizations/new/?plan=' + plan;
|
||||||
|
} else {
|
||||||
|
$('#signinModal').modal({});
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function GuideCtrl($scope) {
|
function GuideCtrl($scope) {
|
||||||
|
@ -1253,7 +1261,7 @@ function OrgsCtrl($scope, UserService) {
|
||||||
browserchrome.update();
|
browserchrome.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
function NewOrgCtrl($scope, $timeout, $location, UserService, PlanService, Restangular) {
|
function NewOrgCtrl($scope, $routeParams, $timeout, $location, UserService, PlanService, Restangular) {
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
|
||||||
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
|
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
|
||||||
|
@ -1261,10 +1269,17 @@ function NewOrgCtrl($scope, $timeout, $location, UserService, PlanService, Resta
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
requested = $routeParams['plan'];
|
||||||
|
|
||||||
// Load the list of plans.
|
// Load the list of plans.
|
||||||
PlanService.getPlans(function(plans) {
|
PlanService.getPlans(function(plans) {
|
||||||
$scope.plans = plans.business;
|
$scope.plans = plans.business;
|
||||||
$scope.currentPlan = null;
|
$scope.currentPlan = null;
|
||||||
|
if (requested) {
|
||||||
|
PlanService.getPlan(requested, function(plan) {
|
||||||
|
$scope.currentPlan = plan;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.setPlan = function(plan) {
|
$scope.setPlan = function(plan) {
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<div class="count"><b>{{ plan.privateRepos }}</b> private repositories</div>
|
<div class="count"><b>{{ plan.privateRepos }}</b> private repositories</div>
|
||||||
<div class="description">{{ plan.audience }}</div>
|
<div class="description">{{ plan.audience }}</div>
|
||||||
<div class="smaller">SSL secured connections</div>
|
<div class="smaller">SSL secured connections</div>
|
||||||
<button class="btn btn-success btn-block" ng-click="buyNow(plan.stripeId)">Sign Up Now</button>
|
<button class="btn btn-success btn-block" ng-click="createOrg(plan.stripeId)">Sign Up Now</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue