Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions shared/scripts/lib/pages/donations/donations.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ <h2>Make a contribution</h2>
<tr class="entry hidden"
data-dwolla="{{ author.dwolla }}"
data-paypal="{{ author.paypal }}"
data-bitcoin="{{ author.bitcoin }}"
data-host="{{ entry.author.hostname }}"
>
{%else%}
<tr class="entry"
data-dwolla="{{ author.dwolla }}"
data-paypal="{{ author.paypal }}"
data-bitcoin="{{ author.bitcoin }}"
data-host="{{ entry.author.hostname }}"
>
{%endif%}
Expand Down
17 changes: 15 additions & 2 deletions shared/scripts/lib/pages/donations/donations.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import calculate from '../../utils/calculate';
import { inject as injectDwolla } from '../../processors/dwolla';
import { getDwollaButton as dwollaBtn } from '../../processors/dwolla';
import { inject as injectPaypal } from '../../processors/paypal';
import { inject as injectBitcoin } from '../../processors/bitcoin';
import { defaults } from '../../defaults';

function DonationsPage() {
Expand Down Expand Up @@ -145,9 +146,10 @@ DonationsPage.prototype = {

var dwollaToken = $component.attr('data-dwolla');
var paypalToken = $component.attr('data-paypal');
var bitcoinToken = $component.attr('data-bitcoin');

// Hide the no processors text.
if (dwollaToken || paypalToken) {
if (dwollaToken || paypalToken || bitcoinToken) {
payment.empty();
}

Expand All @@ -160,6 +162,11 @@ DonationsPage.prototype = {
if (paypalToken) {
$component.data().paypal = injectPaypal(payment, amount, paypalToken);
}

// Only inject if the author has bitcoin.
if (bitcoinToken) {
$component.data().bitcoin = injectBitcoin(payment, amount, bitcoinToken);
}

if (dwollaToken && !payment.hasClass("d-btn")) {
payment.prepend(dwollaBtn(payment, amount, dwollaToken));
Expand Down Expand Up @@ -474,9 +481,10 @@ DonationsPage.prototype = {

var dwollaToken = $component.attr('data-dwolla');
var paypalToken = $component.attr('data-paypal');
var bitcoinToken = $component.attr('data-bitcoin');

// Hide the no processors text.
if (dwollaToken || paypalToken) {
if (dwollaToken || paypalToken || bitcoinToken) {
payment.empty();
}

Expand All @@ -491,6 +499,11 @@ DonationsPage.prototype = {
$component.data().paypal = injectPaypal(payment, amount, paypalToken);
}

// Only inject if the author has bitcoin.
if (bitcoinToken) {
$component.data().bitcoin = injectBitcoin(payment, amount, bitcoinToken);
}

});

//return storage.set('settings', settings);
Expand Down
1 change: 1 addition & 0 deletions shared/scripts/lib/pages/donations/entry-donation.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<tr class="subentry"
data-dwolla="{{ author.dwolla }}"
data-paypal="{{ author.paypal }}"
data-bitcoin="{{ author.bitcoin }}"
data-host="{{ visit.author.hostname }}"
data-url="{{ visit.tab.url }}"
>
Expand Down
13 changes: 13 additions & 0 deletions shared/scripts/lib/processors/bitcoin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

export function inject($el, amount, wallet) {

// TODO: amount

var form = $('<div>');

// Add in the Bitcoin donate button.
form.append('<a href="bitcoin:' + wallet + '?label=Tipsy%20contribution"><img src="../../img/bitcoin.png" alt="Donate with Bitcoin"></a>');

form.appendTo($el);
}
7 changes: 7 additions & 0 deletions shared/scripts/lib/utils/tipsy-txt-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ export function parseTxt() {
break;
case "dwolla":
newArray[0].dwolla = splitEntry[1];
break;
case "bitcoin":
newArray[0].bitcoin = splitEntry[1];
break;
}
}

Expand Down Expand Up @@ -195,6 +199,9 @@ export function parseTxt() {
if (paymentMethods[urlPref]) {
newArray[0].paypal = paymentMethods[urlPref].paypal;
}
if (paymentMethods[urlPref]) {
newArray[0].bitcoin = paymentMethods[urlPref].bitcoin;
}
if (info.author) {
newArray[0].name = info.author;
}
Expand Down