Make the pricing page ask for signup and, if completed, redirect to the proper page to subscribe to a plan. Also fixes a redirect issue with Github signin on the new org page

This commit is contained in:
Joseph Schorr 2013-12-11 17:50:48 -05:00
parent 91f4464cb6
commit abe6db334d
5 changed files with 109 additions and 24 deletions

View file

@ -38,10 +38,17 @@ function PlansCtrl($scope, $location, UserService, PlanService) {
$scope.user = currentUser;
}, true);
$scope.signedIn = function() {
$('#signinModal').modal('hide');
PlanService.handleNotedPlan();
};
$scope.buyNow = function(plan) {
if ($scope.user && !$scope.user.anonymous) {
document.location = '/user?plan=' + plan;
} else {
PlanService.notePlan(plan);
$('#signinModal').modal({});
}
};
@ -50,6 +57,7 @@ function PlansCtrl($scope, $location, UserService, PlanService) {
if ($scope.user && !$scope.user.anonymous) {
document.location = '/organizations/new/?plan=' + plan;
} else {
PlanService.notePlan(plan);
$('#signinModal').modal({});
}
};
@ -106,7 +114,7 @@ function RepoListCtrl($scope, Restangular, UserService) {
});
}
function LandingCtrl($scope, $timeout, $location, Restangular, UserService, KeyService) {
function LandingCtrl($scope, $timeout, $location, Restangular, UserService, KeyService, PlanService) {
$scope.namespace = null;
$scope.$watch('namespace', function(namespace) {
@ -1270,7 +1278,7 @@ function OrgsCtrl($scope, UserService) {
function NewOrgCtrl($scope, $routeParams, $timeout, $location, UserService, PlanService, Restangular) {
$scope.loading = true;
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
$scope.$watch(function () { return UserService.currentUser(); }, function (currentUser) {
$scope.user = currentUser;
$scope.loading = false;
}, true);
@ -1288,6 +1296,16 @@ function NewOrgCtrl($scope, $routeParams, $timeout, $location, UserService, Plan
}
});
$scope.signedIn = function() {
PlanService.handleNotedPlan();
};
$scope.signinStarted = function() {
PlanService.getMinimumPlan(1, true, function(plan) {
PlanService.notePlan(plan.stripeId);
});
};
$scope.setPlan = function(plan) {
$scope.currentPlan = plan;
};