Add a plans/pricing page

This commit is contained in:
Joseph Schorr 2013-10-02 18:14:51 -04:00
parent c2e9a766f7
commit 0ce2252d1d
7 changed files with 171 additions and 6 deletions

View file

@ -77,6 +77,20 @@ function HeaderCtrl($scope, UserService) {
});
}
function PlansCtrl($scope, UserService) {
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
$scope.user = currentUser;
}, true);
$scope.buyNow = function(plan) {
if ($scope.user && !$scope.user.anonymous) {
document.location = '#/user?plan=' + plan;
} else {
$('#signinModal').modal({});
}
};
}
function GuideCtrl($scope, Restangular) {
}
@ -439,7 +453,7 @@ function UserAdminCtrl($scope, Restangular) {
stripeId: 'micro',
},
{
title: 'Small',
title: 'Basic',
price: 1200,
privateRepos: 10,
stripeId: 'small',
@ -542,4 +556,20 @@ function UserAdminCtrl($scope, Restangular) {
$scope.planChanging = false;
});
};
// Show the subscribe dialog if a plan was requested.
if (location.hash.indexOf('?') >= 0) {
var query = location.hash.substr(1).split('?')[1];
var data = query.split("&");
for (var i = 0; i < data.length; i++) {
var item = data[i].split("=");
if (item[0] == 'plan') {
var planId = item[1];
if (planDict[planId]) {
$scope.subscribe(planId);
}
break;
}
}
}
}