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() {
|
||||
if ($scope.plans) { return; }
|
||||
if ($scope.plans || $scope.loadingPlans) { return; }
|
||||
if (!$scope.user && !$scope.organization) { return; }
|
||||
|
||||
$scope.loadingPlans = true;
|
||||
PlanService.getPlans(function(plans) {
|
||||
$scope.plans = plans[$scope.organization ? 'business' : 'user'];
|
||||
update();
|
||||
|
||||
if ($scope.readyForPlan) {
|
||||
var planRequested = $scope.readyForPlan();
|
||||
if (planRequested) {
|
||||
if (planRequested && planRequested != getFreePlan()) {
|
||||
$scope.changeSubscription(planRequested);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ function SigninCtrl($scope, $location, $timeout, Restangular, KeyService, UserSe
|
|||
$scope.status = 'ready';
|
||||
};
|
||||
|
||||
function PlansCtrl($scope, UserService, PlanService) {
|
||||
function PlansCtrl($scope, $location, UserService, PlanService) {
|
||||
// Load the list of plans.
|
||||
PlanService.getPlans(function(plans) {
|
||||
$scope.plans = plans;
|
||||
|
@ -107,6 +107,14 @@ function PlansCtrl($scope, UserService, PlanService) {
|
|||
$('#signinModal').modal({});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.createOrg = function(plan) {
|
||||
if ($scope.user && !$scope.user.anonymous) {
|
||||
document.location = '/organizations/new/?plan=' + plan;
|
||||
} else {
|
||||
$('#signinModal').modal({});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function GuideCtrl($scope) {
|
||||
|
@ -1253,7 +1261,7 @@ function OrgsCtrl($scope, UserService) {
|
|||
browserchrome.update();
|
||||
}
|
||||
|
||||
function NewOrgCtrl($scope, $timeout, $location, UserService, PlanService, Restangular) {
|
||||
function NewOrgCtrl($scope, $routeParams, $timeout, $location, UserService, PlanService, Restangular) {
|
||||
$scope.loading = true;
|
||||
|
||||
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
|
||||
|
@ -1261,10 +1269,17 @@ function NewOrgCtrl($scope, $timeout, $location, UserService, PlanService, Resta
|
|||
$scope.loading = false;
|
||||
}, true);
|
||||
|
||||
requested = $routeParams['plan'];
|
||||
|
||||
// Load the list of plans.
|
||||
PlanService.getPlans(function(plans) {
|
||||
$scope.plans = plans.business;
|
||||
$scope.currentPlan = null;
|
||||
if (requested) {
|
||||
PlanService.getPlan(requested, function(plan) {
|
||||
$scope.currentPlan = plan;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$scope.setPlan = function(plan) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<div class="count"><b>{{ plan.privateRepos }}</b> private repositories</div>
|
||||
<div class="description">{{ plan.audience }}</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>
|
||||
|
|
Reference in a new issue