From 981edd413acfdd4786faf5439d2a05d6d7e4649e Mon Sep 17 00:00:00 2001 From: Glandos Date: Thu, 7 May 2020 22:56:17 +0200 Subject: Improve currencies (#604) - Rename "No Currency" to ISO4217 "XXX" - Use Babel to render currency symbols and names in currency lists - Improve i18n in bill lists Fix #601 Fix #600 --- ihatemoney/templates/forms.html | 2 +- ihatemoney/templates/list_bills.html | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'ihatemoney/templates') diff --git a/ihatemoney/templates/forms.html b/ihatemoney/templates/forms.html index 0900d2f..82b960e 100644 --- a/ihatemoney/templates/forms.html +++ b/ihatemoney/templates/forms.html @@ -124,7 +124,7 @@ {{ input(form.what, inline=True) }} {{ input(form.payer, inline=True, class="form-control custom-select") }} {{ input(form.amount, inline=True) }} - {% if not form.original_currency.render_kw %} + {% if g.project.default_currency != "XXX" %} {{ input(form.original_currency, inline=True) }} {% endif %} {{ input(form.external_link, inline=True) }} diff --git a/ihatemoney/templates/list_bills.html b/ihatemoney/templates/list_bills.html index be55c19..7ae3bd6 100644 --- a/ihatemoney/templates/list_bills.html +++ b/ihatemoney/templates/list_bills.html @@ -1,5 +1,9 @@ {% extends "sidebar_table_layout.html" %} +{%- macro bill_amount(bill, currency=bill.original_currency, amount=bill.amount) %} + {{ amount|currencyformat_nc(currency) }} ({{ _("%(amount)s each", amount=bill.pay_each_default(amount)|currencyformat_nc(currency)) }}) +{% endmacro -%} + {% block title %} - {{ g.project.name }}{% endblock %} {% block js %} {% if add_bill %} $('#new-bill > a').click(); {% endif %} @@ -123,11 +127,6 @@ {{ _("For what?") }} {{ _("For whom?") }} {{ _("How much?") }} - {% if g.project.default_currency != "No Currency" %} - {{ _("Amount in %(currency)s", currency=g.project.default_currency) }} - {%- else -%} - {{ _("Amount") }} - {% endif %} {{ _("Actions") }} @@ -149,13 +148,11 @@ {{ bill.owers|join(', ', 'name') }} {%- endif %} - {% if bill.original_currency != "No Currency" %} - {{ "%0.2f"|format(bill.amount) }} {{bill.original_currency}} ({{ "%0.2f"|format(bill.pay_each_default(bill.amount)) }} {{bill.original_currency}} {{ _(" each") }}) - {%- else -%} - {{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each_default(bill.amount)) }} {{ _(" each") }}) - {% endif %} + + {{ bill_amount(bill) }} + - {{ "%0.2f"|format(bill.converted_amount) }} {{ _('edit') }} {{ _('delete') }} -- cgit v1.1