Merge pull request #6 from OniriCorpe/master

Dynamic currency system
This commit is contained in:
Drew DeVault 2018-09-19 16:03:39 -04:00 committed by GitHub
commit 0a52260bc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 92 additions and 56 deletions

View File

@ -31,6 +31,11 @@ connection-string=postgresql://postgres@localhost/fosspay
stripe-secret= stripe-secret=
stripe-publish= stripe-publish=
# Currency to use
# "usd" for dollar, "eur" for euro
# refer to stripe documentation for details : https://stripe.com/docs/currencies
currency=usd
# Separate with spaces # Separate with spaces
default-amounts=3 5 10 20 default-amounts=3 5 10 20
# Which one to pick when they arrive? # Which one to pick when they arrive?

View File

@ -64,24 +64,24 @@
<tr> <tr>
<td><button type="button" class="close">&times;</button></td> <td><button type="button" class="close">&times;</button></td>
<td>{{ project.name }}</td> <td>{{ project.name }}</td>
<td>{{ "{:.2f}".format(one_times(project) / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(one_times(project) / 100)) }}</td>
<td>{{ "{:.2f}".format(recurring(project) / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(recurring(project) / 100)) }}</td>
<td>{{ "{:.2f}".format(recurring_ever(project) / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(recurring_ever(project) / 100)) }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
<tr> <tr>
<td></td> <td></td>
<td>(non précisé)</td> <td>(non précisé)</td>
<td>{{ "{:.2f}".format(unspecified_one_times / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(unspecified_one_times / 100)) }}</td>
<td>{{ "{:.2f}".format(unspecified_recurring / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(unspecified_recurring / 100)) }}</td>
<td>{{ "{:.2f}".format(unspecified_recurring_ever / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(unspecified_recurring_ever / 100)) }}</td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><strong>Total</strong></td> <td><strong>Total</strong></td>
<td>{{ "{:.2f}".format(total_one_time / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(total_one_time / 100)) }}</td>
<td>{{ "{:.2f}".format(total_recurring / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(total_recurring / 100)) }}</td>
<td>{{ "{:.2f}".format(total_recurring_ever / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(total_recurring_ever / 100)) }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -117,7 +117,7 @@
<td><a href="mailto:{{ donation.user.email }}">{{ donation.user.email }}</a></td> <td><a href="mailto:{{ donation.user.email }}">{{ donation.user.email }}</a></td>
<td>{{ donation.project.name if donation.project else "" }}</td> <td>{{ donation.project.name if donation.project else "" }}</td>
<td title="{{ donation.comment }}">{{ donation.comment if donation.comment else "" }}</td> <td title="{{ donation.comment }}">{{ donation.comment if donation.comment else "" }}</td>
<td>{{ "{:.2f}".format(donation.amount / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(donation.amount / 100)) }}</td>
<td> <td>
{{ "Unique" if str(donation.type) == "DonationType.one_time" else "Mensuel" }} {{ "Unique" if str(donation.type) == "DonationType.one_time" else "Mensuel" }}
{{ "(cancelled)" if not donation.active else "" }} {{ "(cancelled)" if not donation.active else "" }}

View File

@ -23,21 +23,21 @@
class="progress-bar progress-bar-primary" class="progress-bar progress-bar-primary"
style="width: {{ recurring_progress * 100 }}%; line-height: 2.5" style="width: {{ recurring_progress * 100 }}%; line-height: 2.5"
> >
<span>{{ "{:.0f}".format(recurring_sum / 100) }}</span> <span>{{ currency.amount("{:.0f}".format(recurring_sum / 100)) }}</span>
</div> </div>
<div <div
class="progress-bar progress-bar-info" class="progress-bar progress-bar-info"
style="width: {{ patreon_progress * 100 }}%; line-height: 2.5" style="width: {{ patreon_progress * 100 }}%; line-height: 2.5"
> >
<span>{{ "{:.0f}".format(patreon_sum / 100) }}</span> <span>{{ currency.amount("{:.0f}".format(patreon_sum / 100)) }}</span>
</div> </div>
<div <div
class="progress-bar progress-bar-warning" class="progress-bar progress-bar-warning"
style="width: {{ lp_progress * 100 }}%; line-height: 2.5" style="width: {{ lp_progress * 100 }}%; line-height: 2.5"
> >
<span>{{ "{:.0f}".format(lp_sum / 100) }}</span> <span>{{ currency.amount("{:.0f}".format(lp_sum / 100)) }}</span>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -47,13 +47,13 @@
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
{% if patreon_count or lp_count %} {% if patreon_count or lp_count %}
<p> <p>
{{ "{:.2f}".format(recurring_sum / 100) }} par mois {{ currency.amount("{:.2f}".format(recurring_sum / 100)) }} par mois
via <strong class="text-primary">{{ domain }}</strong> via <strong class="text-primary">{{ domain }}</strong>
({{ recurring_count }} donateurice{{ "s" if recurring_count != 1 else "" }}) ({{ recurring_count }} donateurice{{ "s" if recurring_count != 1 else "" }})
</p> </p>
{% if patreon_count %} {% if patreon_count %}
<p> <p>
{{ "{:.2f}".format(patreon_sum / 100) }} par mois {{ currency.amount("{:.2f}".format(patreon_sum / 100)) }} par mois
via via
<strong><a <strong><a
href="https://patreon.com/{{ _cfg("patreon-campaign") }}" href="https://patreon.com/{{ _cfg("patreon-campaign") }}"
@ -64,7 +64,7 @@
{% endif %} {% endif %}
{% if lp_count %} {% if lp_count %}
<p> <p>
{{ "{:.2f}".format(lp_sum / 100) }} par mois {{ currency.amount("{:.2f}".format(lp_sum / 100)) }} par mois
via via
<strong><a <strong><a
class="text-warning" class="text-warning"
@ -76,14 +76,14 @@
{% endif %} {% endif %}
{% if goal %} {% if goal %}
<p class="{{ "text-center" if not patreon_sum else "" }}"> <p class="{{ "text-center" if not patreon_sum else "" }}">
{{ "{:.2f}".format(total_sum / 100)}} par mois {{ currency.amount("{:.2f}".format(total_sum / 100))}} par mois
sur l'objectif de sur l'objectif de
{{ "{:.2f}".format(goal / 100) }}. {{ currency.amount("{:.2f}".format(goal / 100)) }}.
</p> </p>
{% else %} {% else %}
<p> <p>
Supported with ${{ "{:.2f}".format(total_sum / 100) }} Soutenu par {{ total_count }} personne{{ "s" if total_count != 1 else "" }}
from {{ total_count }} supporters! pour un montant total de {{ currency.amount("{:.2f}".format(total_sum / 100)) }}
</p> </p>
{% endif %} {% endif %}
</div> </div>

View File

@ -17,6 +17,8 @@ const i18n = {
}; };
// Fin de traduction // Fin de traduction
const currency = "{{ _cfg("currency") }}";
{% if user %} {% if user %}
window.email = "{{user.email}}"; window.email = "{{user.email}}";
{% endif %} {% endif %}
@ -66,7 +68,7 @@ window.email = "{{user.email}}";
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button data-amount="{{ amt }}" type="button" <button data-amount="{{ amt }}" type="button"
class="btn btn-default {{"active" if _cfg("default-amount") == amt else ""}}" class="btn btn-default {{"active" if _cfg("default-amount") == amt else ""}}"
>{{ amt }}</button> >{{ currency.amount(amt) }}</button>
</div> </div>
{% endfor %} {% endfor %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
@ -79,7 +81,7 @@ window.email = "{{user.email}}";
<div class="col-md-4 col-md-offset-4"> <div class="col-md-4 col-md-offset-4">
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"></span> <span class="input-group-addon">{{ currency.symbol }}</span>
<input id="custom-amount-text" type="text" value="13.12" <input id="custom-amount-text" type="text" value="13.12"
class="form-control" placeholder="Montant" /> class="form-control" placeholder="Montant" />
</div> </div>

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="static/icon.png" type="image/png" /> <link rel="icon" href="static/icon.png" type="image/png" />
{% block title %} {% block title %}
<title>Donations pour {{_cfg("your-name")}}</title> <title>Donner au {{_cfg("your-name")}}</title>
{% endblock %} {% endblock %}
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
{% block styles %}{% endblock %} {% block styles %}{% endblock %}

View File

@ -30,7 +30,7 @@
</form> </form>
</td> </td>
<td>{{ donation.created.strftime("%d-%m-%Y") }}</td> <td>{{ donation.created.strftime("%d-%m-%Y") }}</td>
<td>{{ "{:.2f}".format(donation.amount / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(donation.amount / 100)) }}</td>
<td>{{ donation.project.name if donation.project else "Non précisé" }}</td> <td>{{ donation.project.name if donation.project else "Non précisé" }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -51,7 +51,7 @@
{% for donation in one_times(user) %} {% for donation in one_times(user) %}
<tr> <tr>
<td>{{ donation.created.strftime("%d-%m-%Y") }}</td> <td>{{ donation.created.strftime("%d-%m-%Y") }}</td>
<td>{{ "{:.2f}".format(donation.amount / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(donation.amount / 100)) }}</td>
<td>{{ donation.project.name if donation.project else "Non précisé" }}</td> <td>{{ donation.project.name if donation.project else "Non précisé" }}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -1,5 +1,5 @@
An attempt was just made to charge your card for your monthly donation to An attempt was just made to charge your card for your monthly donation to
{{your_name}} for ${{amount}}. Unfortunately, your card was declined. {{your_name}} for {{amount}}. Unfortunately, your card was declined.
The donation has been disabled. If you would like to, you may create a new The donation has been disabled. If you would like to, you may create a new
recurring donation here: recurring donation here:

View File

@ -3,10 +3,10 @@ Thank you for donating!
Receipt: Receipt:
{{#monthly}} {{#monthly}}
Monthly donation ${{amount}} Monthly donation {{amount}}
{{/monthly}} {{/monthly}}
{{^monthly}} {{^monthly}}
One-time donation ${{amount}} One-time donation {{amount}}
{{/monthly}} {{/monthly}}
You can view and manage your donations online here: You can view and manage your donations online here:

View File

@ -6,6 +6,7 @@ from fosspay.database import db
from fosspay.common import * from fosspay.common import *
from fosspay.config import _cfg, load_config from fosspay.config import _cfg, load_config
from fosspay.email import send_thank_you, send_password_reset from fosspay.email import send_thank_you, send_password_reset
from fosspay.currency import currency
import os import os
import locale import locale
@ -75,7 +76,7 @@ def index():
patreon_count=patreon_count, patreon_count=patreon_count,
patreon_sum=patreon_sum, patreon_sum=patreon_sum,
lp_count=lp_count, lp_count=lp_count,
lp_sum=lp_sum) lp_sum=lp_sum, currency=currency)
@html.route("/setup", methods=["POST"]) @html.route("/setup", methods=["POST"])
def setup(): def setup():
@ -103,6 +104,7 @@ def admin():
first=first, first=first,
projects=projects, projects=projects,
donations=donations, donations=donations,
currency=currency,
one_times=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.one_time]), one_times=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.one_time]),
recurring=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.monthly and d.active]), recurring=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.monthly and d.active]),
recurring_ever=lambda p: sum([d.amount * d.payments for d in p.donations if d.type == DonationType.monthly]), recurring_ever=lambda p: sum([d.amount * d.payments for d in p.donations if d.type == DonationType.monthly]),
@ -202,7 +204,7 @@ def donate():
try: try:
charge = stripe.Charge.create( charge = stripe.Charge.create(
amount=amount, amount=amount,
currency="usd", currency=_cfg("currency"),
customer=user.stripe_customer, customer=user.stripe_customer,
description="Donation to " + _cfg("your-name") description="Donation to " + _cfg("your-name")
) )
@ -276,7 +278,8 @@ def reset_password(token):
def panel(): def panel():
return render_template("panel.html", return render_template("panel.html",
one_times=lambda u: [d for d in u.donations if d.type == DonationType.one_time], one_times=lambda u: [d for d in u.donations if d.type == DonationType.one_time],
recurring=lambda u: [d for d in u.donations if d.type == DonationType.monthly and d.active]) recurring=lambda u: [d for d in u.donations if d.type == DonationType.monthly and d.active],
currency=currency)
@html.route("/cancel/<id>") @html.route("/cancel/<id>")
@loginrequired @loginrequired

21
fosspay/currency.py Normal file
View File

@ -0,0 +1,21 @@
from fosspay.config import _cfg
class Currency:
def __init__(self, symbol, position):
self.symbol = symbol
self.position = position
def amount(self, amount):
if self.position == "right":
return amount + self.symbol
else:
return self.symbol + amount
currencies = {
'usd' : Currency("$", "left"),
'eur' : Currency("", "right")
# ... More currencies can be added here
}
currency = currencies[_cfg("currency")]

View File

@ -10,6 +10,7 @@ from flask import url_for
from fosspay.database import db from fosspay.database import db
from fosspay.objects import User from fosspay.objects import User
from fosspay.config import _cfg, _cfgi from fosspay.config import _cfg, _cfgi
from fosspay.currency import currency
def send_thank_you(user, amount, monthly): def send_thank_you(user, amount, monthly):
if _cfg("smtp-host") == "": if _cfg("smtp-host") == "":
@ -24,7 +25,7 @@ def send_thank_you(user, amount, monthly):
"user": user, "user": user,
"root": _cfg("protocol") + "://" + _cfg("domain"), "root": _cfg("protocol") + "://" + _cfg("domain"),
"your_name": _cfg("your-name"), "your_name": _cfg("your-name"),
"amount": "{:.2f}".format(amount / 100), "amount": currency.amount("{:.2f}".format(amount / 100)),
"monthly": monthly, "monthly": monthly,
"your_email": _cfg("your-email") "your_email": _cfg("your-email")
}))) })))
@ -70,7 +71,7 @@ def send_declined(user, amount):
"user": user, "user": user,
"root": _cfg("protocol") + "://" + _cfg("domain"), "root": _cfg("protocol") + "://" + _cfg("domain"),
"your_name": _cfg("your-name"), "your_name": _cfg("your-name"),
"amount": "{:.2f}".format(amount / 100) "amount": currency.amount("{:.2f}".format(amount / 100))
}))) })))
message['Subject'] = "Your monthly donation was declined." message['Subject'] = "Your monthly donation was declined."
message['From'] = _cfg("smtp-from") message['From'] = _cfg("smtp-from")

View File

@ -78,6 +78,7 @@
description: donation.type == "monthly" ? i18n["Monthly Donation"] : i18n["One-time Donation"], description: donation.type == "monthly" ? i18n["Monthly Donation"] : i18n["One-time Donation"],
panelLabel: i18n["Donate "] + "{{amount}}", panelLabel: i18n["Donate "] + "{{amount}}",
amount: donation.amount, amount: donation.amount,
currency: currency,
token: function(token) { token: function(token) {
e.target.setAttribute("disabled", ""); e.target.setAttribute("disabled", "");
e.target.textContent = i18n["Submitting..."]; e.target.textContent = i18n["Submitting..."];

View File

@ -65,24 +65,24 @@
<tr> <tr>
<td><button type="button" class="close">&times;</button></td> <td><button type="button" class="close">&times;</button></td>
<td>{{ project.name }}</td> <td>{{ project.name }}</td>
<td>${{ "{:.2f}".format(one_times(project) / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(one_times(project) / 100)) }}</td>
<td>${{ "{:.2f}".format(recurring(project) / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(recurring(project) / 100)) }}</td>
<td>${{ "{:.2f}".format(recurring_ever(project) / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(recurring_ever(project) / 100)) }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
<tr> <tr>
<td></td> <td></td>
<td>(not specified)</td> <td>(not specified)</td>
<td>${{ "{:.2f}".format(unspecified_one_times / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(unspecified_one_times / 100)) }}</td>
<td>${{ "{:.2f}".format(unspecified_recurring / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(unspecified_recurring / 100)) }}</td>
<td>${{ "{:.2f}".format(unspecified_recurring_ever / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(unspecified_recurring_ever / 100)) }}</td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><strong>Total</strong></td> <td><strong>Total</strong></td>
<td>${{ "{:.2f}".format(total_one_time / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(total_one_time / 100)) }}</td>
<td>${{ "{:.2f}".format(total_recurring / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(total_recurring / 100)) }}</td>
<td>${{ "{:.2f}".format(total_recurring_ever / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(total_recurring_ever / 100)) }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -118,7 +118,7 @@
<td><a href="mailto:{{ donation.user.email }}">{{ donation.user.email }}</a></td> <td><a href="mailto:{{ donation.user.email }}">{{ donation.user.email }}</a></td>
<td>{{ donation.project.name if donation.project else "" }}</td> <td>{{ donation.project.name if donation.project else "" }}</td>
<td title="{{ donation.comment }}">{{ donation.comment if donation.comment else "" }}</td> <td title="{{ donation.comment }}">{{ donation.comment if donation.comment else "" }}</td>
<td>${{ "{:.2f}".format(donation.amount / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(donation.amount / 100)) }}</td>
<td> <td>
{{ "Once" if str(donation.type) == "DonationType.one_time" else "Monthly" }} {{ "Once" if str(donation.type) == "DonationType.one_time" else "Monthly" }}
{{ "(cancelled)" if not donation.active else "" }} {{ "(cancelled)" if not donation.active else "" }}

View File

@ -23,21 +23,21 @@
class="progress-bar progress-bar-primary" class="progress-bar progress-bar-primary"
style="width: {{ recurring_progress * 100 }}%; line-height: 2.5" style="width: {{ recurring_progress * 100 }}%; line-height: 2.5"
> >
<span>${{ "{:.0f}".format(recurring_sum / 100) }}</span> <span>{{ currency.amount("{:.0f}".format(recurring_sum / 100)) }}</span>
</div> </div>
<div <div
class="progress-bar progress-bar-info" class="progress-bar progress-bar-info"
style="width: {{ patreon_progress * 100 }}%; line-height: 2.5" style="width: {{ patreon_progress * 100 }}%; line-height: 2.5"
> >
<span>${{ "{:.0f}".format(patreon_sum / 100) }}</span> <span>{{ currency.amount("{:.0f}".format(patreon_sum / 100)) }}</span>
</div> </div>
<div <div
class="progress-bar progress-bar-warning" class="progress-bar progress-bar-warning"
style="width: {{ lp_progress * 100 }}%; line-height: 2.5" style="width: {{ lp_progress * 100 }}%; line-height: 2.5"
> >
<span>${{ "{:.0f}".format(lp_sum / 100) }}</span> <span>{{ currency.amount("{:.0f}".format(lp_sum / 100)) }}</span>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -47,13 +47,13 @@
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
{% if patreon_count or lp_count %} {% if patreon_count or lp_count %}
<p> <p>
${{ "{:.2f}".format(recurring_sum / 100) }}/mo {{ currency.amount("{:.2f}".format(recurring_sum / 100)) }}/mo
via <strong class="text-primary">{{ domain }}</strong> via <strong class="text-primary">{{ domain }}</strong>
({{ recurring_count }} supporter{{ "s" if recurring_count != 1 else "" }}) ({{ recurring_count }} supporter{{ "s" if recurring_count != 1 else "" }})
</p> </p>
{% if patreon_count %} {% if patreon_count %}
<p> <p>
${{ "{:.2f}".format(patreon_sum / 100) }}/mo {{ currency.amount("{:.2f}".format(patreon_sum / 100)) }}/mo
via via
<strong><a <strong><a
href="https://patreon.com/{{ _cfg("patreon-campaign") }}" href="https://patreon.com/{{ _cfg("patreon-campaign") }}"
@ -64,7 +64,7 @@
{% endif %} {% endif %}
{% if lp_count %} {% if lp_count %}
<p> <p>
${{ "{:.2f}".format(lp_sum / 100) }}/mo {{ currency.amount("{:.2f}".format(lp_sum / 100)) }}/mo
via via
<strong><a <strong><a
class="text-warning" class="text-warning"
@ -76,14 +76,14 @@
{% endif %} {% endif %}
{% if goal %} {% if goal %}
<p class="{{ "text-center" if not patreon_sum else "" }}"> <p class="{{ "text-center" if not patreon_sum else "" }}">
${{ "{:.2f}".format(total_sum / 100)}}/mo {{ currency.amount("{:.2f}".format(total_sum / 100))}}/mo
of of
${{ "{:.2f}".format(goal / 100) }}/mo {{ currency.amount("{:.2f}".format(goal / 100)) }}/mo
goal goal
</p> </p>
{% else %} {% else %}
<p> <p>
Supported with ${{ "{:.2f}".format(total_sum / 100) }} Supported with {{ currency.amount("{:.2f}".format(total_sum / 100)) }}
from {{ total_count }} supporters! from {{ total_count }} supporters!
</p> </p>
{% endif %} {% endif %}

View File

@ -15,6 +15,9 @@ const i18n = {
"Submitting...": "Submitting...", "Submitting...": "Submitting...",
"Donate": "Donate" "Donate": "Donate"
}; };
// End of translation of index.js
const currency = "{{ _cfg("currency") }}";
{% if user %} {% if user %}
window.email = "{{user.email}}"; window.email = "{{user.email}}";
@ -65,7 +68,7 @@ window.email = "{{user.email}}";
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button data-amount="{{ amt }}" type="button" <button data-amount="{{ amt }}" type="button"
class="btn btn-default {{"active" if _cfg("default-amount") == amt else ""}}" class="btn btn-default {{"active" if _cfg("default-amount") == amt else ""}}"
>${{ amt }}</button> >{{ currency.amount(amt) }}</button>
</div> </div>
{% endfor %} {% endfor %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
@ -78,7 +81,7 @@ window.email = "{{user.email}}";
<div class="col-md-4 col-md-offset-4"> <div class="col-md-4 col-md-offset-4">
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon">$</span> <span class="input-group-addon">{{ currency.symbol }}</span>
<input id="custom-amount-text" type="text" value="13.37" <input id="custom-amount-text" type="text" value="13.37"
class="form-control" placeholder="Amount" /> class="form-control" placeholder="Amount" />
</div> </div>

View File

@ -30,7 +30,7 @@
</form> </form>
</td> </td>
<td>{{ donation.created.strftime("%Y-%m-%d") }}</td> <td>{{ donation.created.strftime("%Y-%m-%d") }}</td>
<td>${{ "{:.2f}".format(donation.amount / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(donation.amount / 100)) }}</td>
<td>{{ donation.project.name if donation.project else "Not specified" }}</td> <td>{{ donation.project.name if donation.project else "Not specified" }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -51,7 +51,7 @@
{% for donation in one_times(user) %} {% for donation in one_times(user) %}
<tr> <tr>
<td>{{ donation.created.strftime("%Y-%m-%d") }}</td> <td>{{ donation.created.strftime("%Y-%m-%d") }}</td>
<td>${{ "{:.2f}".format(donation.amount / 100) }}</td> <td>{{ currency.amount("{:.2f}".format(donation.amount / 100)) }}</td>
<td>{{ donation.project.name if donation.project else "Not specified" }}</td> <td>{{ donation.project.name if donation.project else "Not specified" }}</td>
</tr> </tr>
{% endfor %} {% endfor %}