Skip to content

Commit

Permalink
Merge pull request #1 from codefordc/master
Browse files Browse the repository at this point in the history
pulling the current update
  • Loading branch information
mrkem598 authored May 21, 2018
2 parents a701e03 + 67c09bb commit dac39cc
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
2.4.3
70 changes: 38 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
colorator (1.1.0)
colored (1.2)
ethon (0.10.1)
colorize (0.8.1)
concurrent-ruby (1.0.5)
ethon (0.11.0)
ffi (>= 1.3.0)
execjs (2.7.0)
faraday (0.10.0)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.14)
ffi (1.9.18)
forwardable-extended (2.6.0)
gemoji (2.1.0)
github-pages (109)
Expand Down Expand Up @@ -59,19 +60,20 @@ GEM
octokit (~> 4.0)
public_suffix (~> 2.0)
typhoeus (~> 0.7)
html-pipeline (2.4.2)
html-pipeline (2.7.1)
activesupport (>= 2)
nokogiri (>= 1.4)
html-proofer (3.4.0)
html-proofer (3.7.6)
activesupport (>= 4.2, < 6.0)
addressable (~> 2.3)
colored (~> 1.2)
colorize (~> 0.8)
mercenary (~> 0.3.2)
nokogiri (~> 1.5)
nokogiri (~> 1.8.1)
parallel (~> 1.3)
typhoeus (~> 0.7)
yell (~> 2.0)
i18n (0.7.0)
i18n (0.9.1)
concurrent-ruby (~> 1.0)
jekyll (3.3.1)
addressable (~> 2.4)
colorator (~> 1.0)
Expand Down Expand Up @@ -120,50 +122,54 @@ GEM
jekyll (~> 3.3)
jekyll-titles-from-headings (0.1.2)
jekyll (~> 3.3)
jekyll-watch (1.5.0)
listen (~> 3.0, < 3.1)
jekyll-watch (1.5.1)
listen (~> 3.0)
jemoji (0.7.0)
activesupport (~> 4.0)
gemoji (~> 2.0)
html-pipeline (~> 2.2)
jekyll (>= 3.0)
json (1.8.3)
json (1.8.6)
kramdown (1.11.1)
liquid (3.0.6)
listen (3.0.6)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9.7)
mercenary (0.3.6)
mini_portile2 (2.1.0)
mini_portile2 (2.3.0)
minima (2.0.0)
minitest (5.10.1)
minitest (5.11.1)
multipart-post (2.0.0)
net-dns (0.8.0)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
octokit (4.6.2)
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
octokit (4.8.0)
sawyer (~> 0.8.0, >= 0.5.3)
parallel (1.10.0)
pathutil (0.14.0)
parallel (1.12.1)
pathutil (0.16.1)
forwardable-extended (~> 2.6)
public_suffix (2.0.4)
rb-fsevent (0.9.8)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
public_suffix (2.0.5)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rouge (1.11.1)
safe_yaml (1.0.4)
sass (3.4.23)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
thread_safe (0.3.5)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (0.8.0)
ethon (>= 0.8.0)
tzinfo (1.2.2)
tzinfo (1.2.4)
thread_safe (~> 0.1)
unicode-display_width (1.1.2)
unicode-display_width (1.3.0)
yell (2.0.7)

PLATFORMS
Expand All @@ -174,4 +180,4 @@ DEPENDENCIES
html-proofer

BUNDLED WITH
1.13.7
1.16.0
2 changes: 1 addition & 1 deletion _includes/_global_js.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- This should be inserted in the page *before* any page-specific JS -->
<script src="/assets/js/jquery.js"></script>
<script src="/assets/js/jquery-3.2.1.min.js"></script>
<script src="/assets/js/bootstrap.min.js"></script>
{% for js_name in page.extra_js %}<script src="/assets/js/{{ js_name }}"></script>{% endfor %}

Expand Down
4 changes: 4 additions & 0 deletions assets/js/checkout.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions assets/js/jquery-3.2.1.min.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions assets/js/jquery.js

This file was deleted.

1 change: 1 addition & 0 deletions assets/js/stripe.v3.min.js

Large diffs are not rendered by default.

88 changes: 84 additions & 4 deletions donate.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,92 @@
<div class="container">
<div class="col-sm-12 starter-template">
<h1>Donate</h1>
<p>Support our work! Contributions of any size are helpful and welcome.</p>
<p>All donations are fully tax-deductible through our fiscal sponsor, <a href="https://districtciviclabs.org">District Civic Labs</a>.</p>
</div>
<div class="col-sm-6 col-sm-offset-3">
<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>
<p class="text-center">
<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>
</p>
<form id="donation-form">
<div class="form-group">
<label for="donation-amount"><strong>Amount</strong></label>
<div class="input-group">
<input type="number" id="donation-amount" class="form-control" value="25" aria-label="Amount (to the nearest dollar)">
<span class="input-group-addon" id="basic-addon1">$</span>
</div>
</div>

<div class="form-group">
<label for="special-instructions"><strong>Special Instructions</strong></label>
<input type="text" class="form-control" id="special-instructions" placeholder="">
</div>

<button type="submit" class="btn btn-primary" id="donationButton">Make donation</button>
</form>

<script src="/assets/js/jquery-3.2.1.min.js"></script>
<script src="/assets/js/stripe.v3.min.js"></script>
<script src="/assets/js/checkout.js"></script>
<script>
let apiKey;
let account;
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
// Check if we are working locally and should use test data.
apiKey = 'pk_test_NETzOLRKGqVNftlJdCarfUEN';
account = 'test';
} else {
// Use the live key.
// Stripe is fine with publishing the *public* API key. There's a separate
// secret one that allows for the actual charging of cards and such.
apiKey = 'pk_live_eb4XwCEE1e87bbZNKQrp7QiC';
account = 'live';
}
const handler = StripeCheckout.configure({
key: apiKey,
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
// You can access the token ID with `token.id`.
// Get the token ID to your server-side code for use.
// The "00" is there because Stripe deals in cents rather than dollars, but the form
// only asks for a whole dollar amount.
const amount = Number(document.getElementById('donation-amount').value + "00")
const instruction = document.getElementById('special-instructions').value
// Send a request to our AWS Lambda function, which handles the
// secret Stripe stuff.
let send = JSON.stringify({
"token": token.id,
"amount": amount,
"instruction": instruction,
"email": token.email,
"account": account
});
$.post("https://b9sq87esw7.execute-api.us-east-2.amazonaws.com/prod/codefordc-stripe-processor", send, function(data, status){
if (data.chargeSuccess) {
$('#donation-form').before('<p class="alert alert-success" id="donation-status" role="alert">'+data.message+'</p>')
} else {
$('#donation-form').before('<p class="alert alert-warning" id="donation-status" role="alert">'+data.message+'</p>')
}
});
}
});
document.getElementById('donationButton').addEventListener('click', function(e) {
// Open Checkout with further options:
handler.open({
name: 'Code for DC',
description: 'Donation',
image: 'https://codefordc.org/assets/img/logo/code-for-dc-logo-256.png',
amount: Number(document.getElementById('donation-amount').value + "00"),
allowRememberMe: false
});
e.preventDefault();
// Hide donation status if this isn't the first
$('#donation-status').hide(500);
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
});
</script>

</div>
</div>

Expand Down

0 comments on commit dac39cc

Please sign in to comment.