From 24adbeccfce4aa11e98abe9c85260c82698a4f95 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 22 Jan 2018 14:19:34 +0100 Subject: put currency in all templates --- talerdonations/donations/donations.py | 11 ++++++----- talerdonations/donations/templates/fulfillment.html | 3 ++- talerdonations/donations/templates/index.html | 16 ++++++++-------- 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'talerdonations/donations') diff --git a/talerdonations/donations/donations.py b/talerdonations/donations/donations.py index 5ba4628..dc0657b 100644 --- a/talerdonations/donations/donations.py +++ b/talerdonations/donations/donations.py @@ -40,6 +40,9 @@ CURRENCY = TC["taler"]["currency"].value_string(required=True) app.config.from_object(__name__) +# Will be available in templates +flask.g.currency = CURRENCY + @app.context_processor def utility_processor(): def env(name, default=None): @@ -99,7 +102,7 @@ def internal_error(e): @app.route("/") def index(): - return flask.render_template("templates/index.html", merchant_currency=CURRENCY) + return flask.render_template("templates/index.html") @app.route("/javascript") def javascript_licensing(): @@ -115,8 +118,7 @@ def checkout(): "templates/checkout.html", donation_amount=amount, donation_receiver=donation_receiver, - donation_donor=donation_donor, - merchant_currency=CURRENCY) + donation_donor=donation_donor) @app.route("/provider-not-supported") @@ -165,8 +167,7 @@ def fulfillment(receiver): donation_receiver=extra["receiver"], donation_amount=extra["amount"], donation_donor=extra["donor"], - order_id=order_id, - currency=CURRENCY) + order_id=order_id) # no pay_redirect but article not paid, this should never happen! err_abort(500, message="Internal error, invariant failed", json=pay_status) diff --git a/talerdonations/donations/templates/fulfillment.html b/talerdonations/donations/templates/fulfillment.html index ac6a48b..f128693 100644 --- a/talerdonations/donations/templates/fulfillment.html +++ b/talerdonations/donations/templates/fulfillment.html @@ -4,5 +4,6 @@

Donation Receipt

Thank you, {{ donation_donor }}, for donating {{ donation_amount }} to {{ donation_receiver }}.

-

Please keep the order identifier {{ order_id }} as a receipt for your donation.

+

Please keep the order identifier {{ order_id }} as a receipt for your donation. You can show other people that you donated +by sharing this link with them.

{% endblock main %} diff --git a/talerdonations/donations/templates/index.html b/talerdonations/donations/templates/index.html index b384362..a8a05dc 100644 --- a/talerdonations/donations/templates/index.html +++ b/talerdonations/donations/templates/index.html @@ -4,7 +4,7 @@

Welcome to the Taler Donation "Shop" Demo

This toy donations website shows the user experience for donations with Taler. -You are paying with an imaginary currency ({{ merchant_currency }}). +You are paying with an imaginary currency ({{ g.merchant_currency }}).

@@ -23,7 +23,7 @@ You are paying with an imaginary currency ({{ merchant_currency }}).
-

Please select a project, the amount (*) of {{ merchant_currency }} you +

Please select a project, the amount (*) of {{ g.merchant_currency }} you wish to donate, and enter the name that will appear on your receipt:

@@ -34,19 +34,19 @@ You are paying with an imaginary currency ({{ merchant_currency }}).

- (*) To make it a bit more fun, the 5 {{ merchant_currency }} option is + (*) To make it a bit more fun, the 5 {{ g.merchant_currency }} option is deliberately implemented with a fault: the merchant will try to make you - donate 6 {{ merchant_currency }} instead of the 5 {{ merchant_currency }} you + donate 6 {{ g.merchant_currency }} instead of the 5 {{ g.merchant_currency }} you got to see. But do not worry, you will be given the opportunity to review the final offer from the merchant in a window secured by the Taler extension. That way, you can spot the error before committing to an -- cgit v1.2.3