Move all controllers into page definitions and add support for layout profiles

This commit is contained in:
Joseph Schorr 2015-02-20 18:15:48 -05:00
parent f650479266
commit d6d11644d8
34 changed files with 3744 additions and 3428 deletions

36
static/js/pages/plans.js Normal file
View file

@ -0,0 +1,36 @@
(function() {
/**
* The plans/pricing page.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('plans', 'plans.html', PlansCtrl);
}]);
function PlansCtrl($scope, $location, UserService, PlanService, $routeParams) {
// Monitor any user changes and place the current user into the scope.
UserService.updateUserIn($scope);
$scope.signedIn = function() {
$('#signinModal').modal('hide');
PlanService.handleNotedPlan();
};
$scope.buyNow = function(plan) {
PlanService.notePlan(plan);
if ($scope.user && !$scope.user.anonymous) {
PlanService.handleNotedPlan();
} else {
$('#signinModal').modal({});
}
};
// Load the list of plans.
PlanService.getPlans(function(plans) {
$scope.plans = plans;
if ($scope && $routeParams['trial-plan']) {
$scope.buyNow($routeParams['trial-plan']);
}
}, /* include the personal plan */ true);
}
})();