This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/pages/plans.js
Joseph Schorr 60c4b38ed5 Fix JS errors on Enterprise plans page
- Upgrades Angulartics to 1.1.1 to fix $exceptionHandler issue
- Changes Raven to use an Angular plugin
- Fixes the digest cycle call on the enterprise plans page
2016-06-21 14:11:43 -04:00

60 lines
No EOL
1.7 KiB
JavaScript

(function() {
/**
* The plans/pricing page.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('plans', 'plans.html', PlansCtrl, {
'title': 'Plans and Pricing',
'newLayout': true
});
}]);
function PlansCtrl($scope, $location, UserService, PlanService, $routeParams) {
// Monitor any user changes and place the current user into the scope.
UserService.updateUserIn($scope);
$('.plan-tabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$location.search({'tab': e.target.getAttribute('data-target').substr(1)});
});
$scope.signedIn = function() {
$('#signinModal').modal('hide');
PlanService.handleNotedPlan();
};
$scope.qeStartTrial = function(plan) {
$scope.currentQEPlan = plan;
$('#tectonicManagerDialog').modal('show');
};
$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;
for (var i = 0; i < $scope.plans.length; ++i) {
var plan = plans[i];
if (plan.privateRepos > 20 && !plan.plans_page_hidden) {
$scope.dropdownPlan = plan.stripeId;
break
}
}
if ($scope && $routeParams['trial-plan']) {
$scope.buyNow($routeParams['trial-plan']);
}
if ($scope && $routeParams['tab'] == 'enterprise') {
$('#enterpriseTab').tab('show')
}
}, /* include the personal plan */ true);
}
})();