forked from codebar/planner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add donating through the codebar website
- Loading branch information
1 parent
007734e
commit 39ace08
Showing
31 changed files
with
187 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
$(function() { | ||
var handler = StripeCheckout.configure({ | ||
key: stripePublishableKey, | ||
image: "https://avatars1.githubusercontent.com/u/5642384?v=3&s=300", | ||
currency: 'GBP', | ||
token: function(token) { | ||
var name = $('#donation_name').val(); | ||
var amount = $('#donation_amount').val(); | ||
$.ajax({ | ||
type: "POST", | ||
url: '/donations', | ||
data: { amount: amount*100, name: name, data: token } | ||
}).done(function(response) { | ||
$('.donation-container').html(response); | ||
}).fail(function(xhr, status, e){ | ||
$('.message').html("Your transaction has not been succesful. Please try again."); | ||
}); | ||
} | ||
}); | ||
|
||
$('#donate').on('click', function(e) { | ||
var amount = $('#donation_amount').val(); | ||
if (!$.isNumeric(amount)) { | ||
$('.message').html("You have not entered a valid amount."); | ||
return; | ||
} | ||
|
||
$('.message').html(""); | ||
|
||
handler.open({ | ||
name: 'codebar', | ||
description: 'Donation of £' + amount, | ||
amount: amount*100 | ||
}); | ||
e.preventDefault(); | ||
}); | ||
|
||
$(window).on('popstate', function() { | ||
handler.close(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class DonationsController < ApplicationController | ||
def new | ||
end | ||
|
||
def create | ||
@amount = params[:amount] | ||
|
||
customer = Stripe::Customer.create( | ||
email: params[:data][:email], | ||
description: params[:name], | ||
source: params[:data][:id] | ||
) | ||
|
||
charge = Stripe::Charge.create( | ||
:amount => @amount, | ||
:description => 'Donation to Codebar', | ||
:currency => 'gbp', | ||
:customer => customer.id, | ||
) | ||
|
||
render layout: false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,9 @@ def twitter_id | |
def contact_email | ||
@contact_email ||= @session.present? ? @session.chapter.email : "[email protected]" | ||
end | ||
|
||
def active_link_class(link_path) | ||
current_page?(link_path) ? "active" : "" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.stripe.reverse | ||
.row | ||
%h3 Thank You | ||
%p Your donation has been processed. Thank you for supporting our effort to create a more diverse tech community. | ||
%p If you would like an invoice for your donation, please send an email to [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
- content_for :head do | ||
%script{:type => "text/javascript", :src => "https://checkout.stripe.com/checkout.js"} | ||
|
||
:javascript | ||
var stripePublishableKey = "#{Rails.configuration.stripe[:publishable_key]}" | ||
|
||
|
||
= javascript_include_tag 'donations' | ||
|
||
.stripe.reverse | ||
.row | ||
.large-12.columns | ||
%h2 Donations | ||
|
||
.stripe.reverse.donation-container | ||
.row | ||
.medium-6.columns | ||
%p.lead Firstly thank you for considering a donation to codebar, without your support we would not be able to continue. | ||
%p.lead By donating to codebar you are helping to promote diversity in the tech industry so that more women, LGBTQA and other underrepresented folks will be able to get started with programming and raise their skills to the next level. | ||
.medium-6.columns | ||
= simple_form_for :donation, url: donations_path, method: :post do |f| | ||
= f.input :name, placeholder: "Name (blank for anonymous donations)", required: false, html: {id: "name"} | ||
= f.input :amount, placeholder: "25.00", required: true, id: "amount" | ||
= f.submit :Donate, class: 'button', id: "donate" | ||
.message | ||
|
||
.stripe.reverse.text-center | ||
.row | ||
.small-12.columns | ||
%h3 A big thank you to some of our sponsors | ||
.row.sponsor-row | ||
.medium-2.small-4.columns | ||
= image_tag "sponsors/8th-Light.png", class: "small-image", alt: "codebar logo" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/bloomberg.png", alt: "Bloomberg" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/ustwo.png", alt: "ustwo" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/gds-logo.png", alt: "GDS" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/google.png", alt: "Google" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/mozilla.png", alt: "Mozilla" | ||
.row.sponsor-row | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/pivotal.png", alt: "Pivotal Labs" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/shutl_logo.png", alt: "Shutl" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/softwire.png", alt: "Softwire" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/StreetTeam.png", alt: "StreetTeam" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/the-guardian.png", alt: "The Guardian" | ||
.medium-2.small-4.columns | ||
=image_tag "sponsors/ticketmaster.png", alt: "Ticketmaster" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Rails.application.config.assets.precompile += %w( donations.js ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Rails.configuration.stripe = { | ||
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'], | ||
:secret_key => ENV['STRIPE_SECRET_KEY'] | ||
} | ||
|
||
Stripe.api_key = Rails.configuration.stripe[:secret_key] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters