New welcome page #54

This commit is contained in:
Kyle Drake 2015-02-24 13:23:15 -08:00
parent 7390dbbd4c
commit 029eb57b85
6 changed files with 207 additions and 59 deletions

View file

@ -273,7 +273,7 @@
<h2>Why become a Supporter?</h2>
</div>
</div>
<div class="row">
<div class="col-60" style="margin-left: auto; margin-right: auto">
<ul>
@ -346,7 +346,7 @@
</div>
<div class="modal-body">
<div>
You are <% if current_site && parent_site.plan_type == 'free' %>upgrading<%else%>changing<%end%> to the <strong><span id="upgradeFormPlanName"></span> Plan</strong>. You will be charged <span id="upgradeFormPlanPrice"></span>. <% if current_site && parent_site.plan_type != 'free' %>We'll credit or refund the remaining amount you didn't use on your previous plan.<% end %>
You are <% if current_site && parent_site.plan_type == 'free' %>upgrading<%else%>changing<%end%> to the <strong><span id="upgradeFormPlanName"></span> Plan</strong>. You will be charged <span id="upgradeFormPlanPrice"></span>. <% if current_site && parent_site.plan_type != 'free' %>We'll credit or refund the remaining amount you didn't use on your previous plan.<% end %>
<% unless current_site && parent_site.stripe_customer_id %>
Please enter your Credit Card number:
<% end %>
@ -400,56 +400,5 @@
</div>
<% if current_site %>
<link rel="stylesheet" href="/css/skeuocard.reset.css" />
<link rel="stylesheet" href="/css/skeuocard.css" />
<script src="/js/cssua.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script>
Stripe.setPublishableKey('<%= $config['stripe_publishable_key'] %>')
$('#upgradeForm').submit(function(event) {
if($('#stripe_token').val() != '')
return true
var signupform = $(event.target)
<% if current_site && parent_site.stripe_subscription_id %>
return true
<% end %>
var planError = $('#plan_error')
planError.css('display', 'none')
signupform.find(':submit').prop('disabled', true)
Stripe.card.createToken({
number: $('[name="cc_number"]').val(),
cvc: $('[name="cc_cvc"]').val(),
exp_month: $('[name="cc_exp_month"]').val(),
exp_year: $('[name="cc_exp_year"]').val()
}, function(status, response) {
console.log(response)
if(response.error) {
planError.text(response.error.message)
planError.css('display', 'block')
window.location = '#plan_error_link'
signupform.find(':submit').prop('disabled', false)
return false
} else {
$('.credit-card-input').text('Thank you!')
$('#stripe_token').val(response.id)
signupform.submit()
}
})
return false
})
$(function() {
$('#upgradeForm').find(':submit').prop('disabled', false)
})
</script>
<script src="/js/skeuocard.min.js"></script>
<% end %>
<%== erb :'plan/_signupcode', layout: false %>
<% end %>

View file

@ -0,0 +1,52 @@
<link rel="stylesheet" href="/css/skeuocard.reset.css" />
<link rel="stylesheet" href="/css/skeuocard.css" />
<script src="/js/cssua.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script>
Stripe.setPublishableKey('<%= $config['stripe_publishable_key'] %>')
$('#upgradeForm').submit(function(event) {
if($('#stripe_token').val() != '')
return true
var signupform = $(event.target)
<% if current_site && parent_site.stripe_subscription_id %>
return true
<% end %>
var planError = $('#plan_error')
planError.css('display', 'none')
signupform.find(':submit').prop('disabled', true)
Stripe.card.createToken({
number: $('[name="cc_number"]').val(),
cvc: $('[name="cc_cvc"]').val(),
exp_month: $('[name="cc_exp_month"]').val(),
exp_year: $('[name="cc_exp_year"]').val()
}, function(status, response) {
console.log(response)
if(response.error) {
planError.text(response.error.message)
planError.css('display', 'block')
window.location = '#plan_error_link'
signupform.find(':submit').prop('disabled', false)
return false
} else {
$('.credit-card-input').text('Thank you!')
$('#stripe_token').val(response.id)
signupform.submit()
}
})
return false
})
$(function() {
$('#upgradeForm').find(':submit').prop('disabled', false)
})
</script>
<script src="/js/skeuocard.min.js"></script>