Skip to content

Commit dac39cc

Browse files
authored
Merge pull request #1 from codefordc/master
pulling the current update
2 parents a701e03 + 67c09bb commit dac39cc

File tree

8 files changed

+133
-43
lines changed

8 files changed

+133
-43
lines changed

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.1
1+
2.4.3

Gemfile.lock

+38-32
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ GEM
77
minitest (~> 5.1)
88
thread_safe (~> 0.3, >= 0.3.4)
99
tzinfo (~> 1.1)
10-
addressable (2.5.0)
11-
public_suffix (~> 2.0, >= 2.0.2)
10+
addressable (2.5.2)
11+
public_suffix (>= 2.0.2, < 4.0)
1212
coffee-script (2.4.1)
1313
coffee-script-source
1414
execjs
1515
coffee-script-source (1.12.2)
1616
colorator (1.1.0)
17-
colored (1.2)
18-
ethon (0.10.1)
17+
colorize (0.8.1)
18+
concurrent-ruby (1.0.5)
19+
ethon (0.11.0)
1920
ffi (>= 1.3.0)
2021
execjs (2.7.0)
21-
faraday (0.10.0)
22+
faraday (0.13.1)
2223
multipart-post (>= 1.2, < 3)
23-
ffi (1.9.14)
24+
ffi (1.9.18)
2425
forwardable-extended (2.6.0)
2526
gemoji (2.1.0)
2627
github-pages (109)
@@ -59,19 +60,20 @@ GEM
5960
octokit (~> 4.0)
6061
public_suffix (~> 2.0)
6162
typhoeus (~> 0.7)
62-
html-pipeline (2.4.2)
63+
html-pipeline (2.7.1)
6364
activesupport (>= 2)
6465
nokogiri (>= 1.4)
65-
html-proofer (3.4.0)
66+
html-proofer (3.7.6)
6667
activesupport (>= 4.2, < 6.0)
6768
addressable (~> 2.3)
68-
colored (~> 1.2)
69+
colorize (~> 0.8)
6970
mercenary (~> 0.3.2)
70-
nokogiri (~> 1.5)
71+
nokogiri (~> 1.8.1)
7172
parallel (~> 1.3)
7273
typhoeus (~> 0.7)
7374
yell (~> 2.0)
74-
i18n (0.7.0)
75+
i18n (0.9.1)
76+
concurrent-ruby (~> 1.0)
7577
jekyll (3.3.1)
7678
addressable (~> 2.4)
7779
colorator (~> 1.0)
@@ -120,50 +122,54 @@ GEM
120122
jekyll (~> 3.3)
121123
jekyll-titles-from-headings (0.1.2)
122124
jekyll (~> 3.3)
123-
jekyll-watch (1.5.0)
124-
listen (~> 3.0, < 3.1)
125+
jekyll-watch (1.5.1)
126+
listen (~> 3.0)
125127
jemoji (0.7.0)
126128
activesupport (~> 4.0)
127129
gemoji (~> 2.0)
128130
html-pipeline (~> 2.2)
129131
jekyll (>= 3.0)
130-
json (1.8.3)
132+
json (1.8.6)
131133
kramdown (1.11.1)
132134
liquid (3.0.6)
133135
listen (3.0.6)
134136
rb-fsevent (>= 0.9.3)
135137
rb-inotify (>= 0.9.7)
136138
mercenary (0.3.6)
137-
mini_portile2 (2.1.0)
139+
mini_portile2 (2.3.0)
138140
minima (2.0.0)
139-
minitest (5.10.1)
141+
minitest (5.11.1)
140142
multipart-post (2.0.0)
141143
net-dns (0.8.0)
142-
nokogiri (1.6.8.1)
143-
mini_portile2 (~> 2.1.0)
144-
octokit (4.6.2)
144+
nokogiri (1.8.1)
145+
mini_portile2 (~> 2.3.0)
146+
octokit (4.8.0)
145147
sawyer (~> 0.8.0, >= 0.5.3)
146-
parallel (1.10.0)
147-
pathutil (0.14.0)
148+
parallel (1.12.1)
149+
pathutil (0.16.1)
148150
forwardable-extended (~> 2.6)
149-
public_suffix (2.0.4)
150-
rb-fsevent (0.9.8)
151-
rb-inotify (0.9.7)
152-
ffi (>= 0.5.0)
151+
public_suffix (2.0.5)
152+
rb-fsevent (0.10.2)
153+
rb-inotify (0.9.10)
154+
ffi (>= 0.5.0, < 2)
153155
rouge (1.11.1)
154156
safe_yaml (1.0.4)
155-
sass (3.4.23)
157+
sass (3.5.5)
158+
sass-listen (~> 4.0.0)
159+
sass-listen (4.0.0)
160+
rb-fsevent (~> 0.9, >= 0.9.4)
161+
rb-inotify (~> 0.9, >= 0.9.7)
156162
sawyer (0.8.1)
157163
addressable (>= 2.3.5, < 2.6)
158164
faraday (~> 0.8, < 1.0)
159-
terminal-table (1.7.3)
160-
unicode-display_width (~> 1.1.1)
161-
thread_safe (0.3.5)
165+
terminal-table (1.8.0)
166+
unicode-display_width (~> 1.1, >= 1.1.1)
167+
thread_safe (0.3.6)
162168
typhoeus (0.8.0)
163169
ethon (>= 0.8.0)
164-
tzinfo (1.2.2)
170+
tzinfo (1.2.4)
165171
thread_safe (~> 0.1)
166-
unicode-display_width (1.1.2)
172+
unicode-display_width (1.3.0)
167173
yell (2.0.7)
168174

169175
PLATFORMS
@@ -174,4 +180,4 @@ DEPENDENCIES
174180
html-proofer
175181

176182
BUNDLED WITH
177-
1.13.7
183+
1.16.0

_includes/_global_js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- This should be inserted in the page *before* any page-specific JS -->
2-
<script src="/assets/js/jquery.js"></script>
2+
<script src="/assets/js/jquery-3.2.1.min.js"></script>
33
<script src="/assets/js/bootstrap.min.js"></script>
44
{% for js_name in page.extra_js %}<script src="/assets/js/{{ js_name }}"></script>{% endfor %}
55

assets/js/checkout.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/jquery-3.2.1.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/jquery.js

-5
This file was deleted.

assets/js/stripe.v3.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

donate.html

+84-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,92 @@
55
<div class="container">
66
<div class="col-sm-12 starter-template">
77
<h1>Donate</h1>
8+
<p>Support our work! Contributions of any size are helpful and welcome.</p>
9+
<p>All donations are fully tax-deductible through our fiscal sponsor, <a href="https://districtciviclabs.org">District Civic Labs</a>.</p>
810
</div>
911
<div class="col-sm-6 col-sm-offset-3">
10-
<p>Code for DC is an official brigade of <a href="http://www.codeforamerica.org">Code for America</a>, which is a 501(c)(3) non-profit organization. That means that you can donate to us through them! Click the button below to make that happen:</p>
11-
<p class="text-center">
12-
<a class="btn btn-primary btn-lg" role="button" href="https://secure.codeforamerica.org/page/contribute/default?brigade=Code%20For%20DC">Click here to donate</a>
13-
</p>
12+
<form id="donation-form">
13+
<div class="form-group">
14+
<label for="donation-amount"><strong>Amount</strong></label>
15+
<div class="input-group">
16+
<input type="number" id="donation-amount" class="form-control" value="25" aria-label="Amount (to the nearest dollar)">
17+
<span class="input-group-addon" id="basic-addon1">$</span>
18+
</div>
19+
</div>
20+
21+
<div class="form-group">
22+
<label for="special-instructions"><strong>Special Instructions</strong></label>
23+
<input type="text" class="form-control" id="special-instructions" placeholder="">
24+
</div>
25+
26+
<button type="submit" class="btn btn-primary" id="donationButton">Make donation</button>
27+
</form>
28+
29+
<script src="/assets/js/jquery-3.2.1.min.js"></script>
30+
<script src="/assets/js/stripe.v3.min.js"></script>
31+
<script src="/assets/js/checkout.js"></script>
32+
<script>
33+
let apiKey;
34+
let account;
35+
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
36+
// Check if we are working locally and should use test data.
37+
apiKey = 'pk_test_NETzOLRKGqVNftlJdCarfUEN';
38+
account = 'test';
39+
} else {
40+
// Use the live key.
41+
// Stripe is fine with publishing the *public* API key. There's a separate
42+
// secret one that allows for the actual charging of cards and such.
43+
apiKey = 'pk_live_eb4XwCEE1e87bbZNKQrp7QiC';
44+
account = 'live';
45+
}
46+
const handler = StripeCheckout.configure({
47+
key: apiKey,
48+
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
49+
locale: 'auto',
50+
token: function(token) {
51+
// You can access the token ID with `token.id`.
52+
// Get the token ID to your server-side code for use.
53+
// The "00" is there because Stripe deals in cents rather than dollars, but the form
54+
// only asks for a whole dollar amount.
55+
const amount = Number(document.getElementById('donation-amount').value + "00")
56+
const instruction = document.getElementById('special-instructions').value
57+
// Send a request to our AWS Lambda function, which handles the
58+
// secret Stripe stuff.
59+
let send = JSON.stringify({
60+
"token": token.id,
61+
"amount": amount,
62+
"instruction": instruction,
63+
"email": token.email,
64+
"account": account
65+
});
66+
$.post("https://b9sq87esw7.execute-api.us-east-2.amazonaws.com/prod/codefordc-stripe-processor", send, function(data, status){
67+
if (data.chargeSuccess) {
68+
$('#donation-form').before('<p class="alert alert-success" id="donation-status" role="alert">'+data.message+'</p>')
69+
} else {
70+
$('#donation-form').before('<p class="alert alert-warning" id="donation-status" role="alert">'+data.message+'</p>')
71+
}
72+
});
73+
}
74+
});
75+
document.getElementById('donationButton').addEventListener('click', function(e) {
76+
// Open Checkout with further options:
77+
handler.open({
78+
name: 'Code for DC',
79+
description: 'Donation',
80+
image: 'https://codefordc.org/assets/img/logo/code-for-dc-logo-256.png',
81+
amount: Number(document.getElementById('donation-amount').value + "00"),
82+
allowRememberMe: false
83+
});
84+
e.preventDefault();
85+
// Hide donation status if this isn't the first
86+
$('#donation-status').hide(500);
87+
});
88+
// Close Checkout on page navigation:
89+
window.addEventListener('popstate', function() {
90+
handler.close();
91+
});
92+
</script>
93+
1494
</div>
1595
</div>
1696

0 commit comments

Comments
 (0)