diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-01-22 14:19:34 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-01-22 14:19:34 +0100 |
commit | 24adbeccfce4aa11e98abe9c85260c82698a4f95 (patch) | |
tree | 806d2dd4d05f59e2ddbff73380173b9f92594264 | |
parent | 55ef8f4ade13cc6e20a62de822eb575e789ab81d (diff) | |
download | donations-24adbeccfce4aa11e98abe9c85260c82698a4f95.tar.gz donations-24adbeccfce4aa11e98abe9c85260c82698a4f95.tar.bz2 donations-24adbeccfce4aa11e98abe9c85260c82698a4f95.zip |
put currency in all templates
-rw-r--r-- | talerdonations/donations/donations.py | 11 | ||||
-rw-r--r-- | talerdonations/donations/templates/fulfillment.html | 3 | ||||
-rw-r--r-- | talerdonations/donations/templates/index.html | 16 |
3 files changed, 16 insertions, 14 deletions
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 @@ <h1>Donation Receipt</h1> <p> Thank you, <strong>{{ donation_donor }}</strong>, for donating <strong>{{ donation_amount }}</strong> to <strong>{{ donation_receiver }}</strong>.</p> -<p>Please keep the order identifier <strong>{{ order_id }}</strong> as a receipt for your donation.</p> +<p>Please keep the order identifier <strong>{{ order_id }}</strong> as a receipt for your donation. You can show other people that you donated +by sharing <a href={{ request.url }}>this link</a> with them.</p> {% 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 @@ <h1 lang="en">Welcome to the Taler Donation "Shop" Demo</h1> <p>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 }}). </p> <div class="taler-installed-hide"> @@ -23,7 +23,7 @@ You are paying with an imaginary currency ({{ merchant_currency }}). </div> <div class="taler-installed-show"> - <p>Please select a project, the amount (*) of {{ merchant_currency }} you + <p>Please select a project, the amount (*) of {{ g.merchant_currency }} you wish to donate, and enter the name that will appear on your receipt:</p> <form name="tform" action="checkout" method="GET" class="pure-form"> @@ -34,19 +34,19 @@ You are paying with an imaginary currency ({{ merchant_currency }}). <option value="Tor">Tor</option> </select> <select id="taler-donation" name="donation_amount"> - <option value="{{ merchant_currency }}:0.1">0.1 {{ merchant_currency }}</option> - <option value="{{ merchant_currency }}:1">1 {{ merchant_currency }}</option> - <option value="{{ merchant_currency }}:6">5 {{ merchant_currency }}</option> - <option value="{{ merchant_currency }}:10">10 {{ merchant_currency }}</option> + <option value="{{ g.merchant_currency }}:0.1">0.1 {{ g.merchant_currency }}</option> + <option value="{{ g.merchant_currency }}:1">1 {{ g.merchant_currency }}</option> + <option value="{{ g.merchant_currency }}:6">5 {{ g.merchant_currency }}</option> + <option value="{{ g.merchant_currency }}:10">10 {{ g.merchant_currency }}</option> </select> <input type="text" name="donation_donor" value="Anonymous Donor" /> <input type="submit" class="pure-button pure-button-primary" value="Donate!" /> </div> </form> <p> - (*) 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 |