Make the title of the stripe dialog's subscribe button say "Start Free Trial" if there isn't already a valid credit card on file

This commit is contained in:
Joseph Schorr 2014-04-23 13:01:27 -04:00
parent 8f66c39ff5
commit c6a189001a

View file

@ -1155,7 +1155,8 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
planService.getCardInfo(orgname, function(cardInfo) {
if (plan.price > 0 && (previousSubscribeFailure || !cardInfo.last4)) {
planService.showSubscribeDialog($scope, orgname, planId, callbacks);
var title = cardInfo.last4 ? 'Subscribe' : 'Start Free trial<span style="display:none">{{amount}}</span>';
planService.showSubscribeDialog($scope, orgname, planId, callbacks, title);
return;
}
@ -1228,7 +1229,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
return email;
};
planService.showSubscribeDialog = function($scope, orgname, planId, callbacks) {
planService.showSubscribeDialog = function($scope, orgname, planId, callbacks, opt_title) {
if (!Features.BILLING) { return; }
if (callbacks['opening']) {
@ -1262,7 +1263,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
currency: 'usd',
name: 'Quay.io ' + planDetails.title + ' Subscription',
description: 'Up to ' + planDetails.privateRepos + ' private repositories',
panelLabel: 'Subscribe',
panelLabel: opt_title || 'Subscribe',
token: submitToken,
image: 'static/img/quay-icon-stripe.png',
opened: function() { $scope.$apply(function() { callbacks['opened']() }); },