From 2a1a3c61fa3d5a8a664245665ad525489f6d8fa9 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 9 Sep 2014 20:41:58 -0500 Subject: [PATCH] stripe checkout image; breaks in development because dev copy of image is not public :P --- app/assets/javascripts/static/donate.js | 7 ++++--- app/views/static/donate.html.haml | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/static/donate.js b/app/assets/javascripts/static/donate.js index 66abc8f7..ee714f12 100644 --- a/app/assets/javascripts/static/donate.js +++ b/app/assets/javascripts/static/donate.js @@ -1,13 +1,14 @@ (function() { var donationForm = document.getElementById('donation-form'); var amountField = donationForm.amount; - var tokenField = donationForm.stripe_token; + var tokenField = donationForm.querySelector( + '[name=donation\\[stripe_token\\]]'); var checkout = StripeCheckout.configure({ key: 'pk_test_wEvgn4baD9W5ld5C9JCS9Ahf', // TODO - //image: '/square-image.png', // TODO + image: donationForm.getAttribute('data-checkout-image'), token: function(token) { - stripe_token.value = token.id; + tokenField.value = token.id; donationForm.submit(); } }); diff --git a/app/views/static/donate.html.haml b/app/views/static/donate.html.haml index 30a8822a..81a21d0f 100644 --- a/app/views/static/donate.html.haml +++ b/app/views/static/donate.html.haml @@ -6,8 +6,9 @@ %span.campaign-raised toward our hosting costs this year. Thanks so much! -= form_tag 'TODO', id: 'donation-form' do - = hidden_field_tag 'stripe_token' += form_tag donations_path, method: 'POST', id: 'donation-form', + 'data-checkout-image' => image_path('default-preview.png') do + = hidden_field_tag 'donation[stripe_token]' %header %p#donation-form-title Thanks for supporting Dress to Impress!