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

@ -74,6 +74,7 @@ quayApp = angular.module('quay', ['restangular', 'angularMoment'], function($pro
when('/repository/', {title: 'Repositories', templateUrl: '/static/partials/repo-list.html', controller: RepoListCtrl}).
when('/user', {title: 'User Admin', templateUrl: '/static/partials/user-admin.html', controller: UserAdminCtrl}).
when('/guide/', {title: 'Getting Started Guide', templateUrl: '/static/partials/guide.html', controller: GuideCtrl}).
when('/plans/', {title: 'Quay Plans', templateUrl: '/static/partials/plans.html', controller: PlansCtrl}).
when('/', {title: 'Quay', templateUrl: '/static/partials/landing.html', controller: LandingCtrl}).
otherwise({redirectTo: '/'});
}]).

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;
}
}
}
}