From c0f49cb1248ce010ef644a19f3eff22dd2c7d5fe Mon Sep 17 00:00:00 2001 From: Jojo144 Date: Thu, 31 Aug 2023 23:19:15 +0200 Subject: [PATCH] [History] Small code reorganization --- ihatemoney/templates/history.html | 70 ++++++++++++++++--------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/ihatemoney/templates/history.html b/ihatemoney/templates/history.html index 7ce45750..97523ad9 100644 --- a/ihatemoney/templates/history.html +++ b/ihatemoney/templates/history.html @@ -183,7 +183,7 @@ {% elif event.operation_type == OperationType.UPDATE %} {% if event.object_type == "Project" %} {% if event.prop_changed == "password" %} - {{ _("Project private code changed") }} + {{ _("Project private code changed") }} {% elif event.prop_changed == "logging_preference" %} {{ change_to_logging_preference(event) }} {% elif event.prop_changed == "name" %} @@ -195,42 +195,44 @@ {% else %} {{ _("Project settings modified") }} {% endif %} - {% elif event.prop_changed == "activated" %} - {% if event.val_after == False %} - {% trans %}Participant {{ name }} deactivated{% endtrans %} - {% else %} - {% trans %}Participant {{ name }} reactivated{% endtrans %} - {% endif %} - {% elif event.prop_changed == "name" %} - {% set new_name=event.val_after|em_surround %} - {% trans %}Participant {{ name }} renamed to {{ new_name }}{% endtrans %} - {% elif event.prop_changed == "what" %} + {% elif event.object_type == "Bill" %} + {% if event.prop_changed == "what" %} {% set new_description=event.val_after|em_surround %} {% trans %}Bill {{ name }} renamed to {{ new_description }}{% endtrans %} - {% elif event.prop_changed == "weight" %} - {% set old_weight=event.val_before|em_surround %} - {% set new_weight=event.val_after|em_surround %} - {% trans %}Participant {{ name }}: weight changed from {{ old_weight }} to {{ new_weight }}{% endtrans %} - {% elif event.prop_changed == "external_link" %} - {{ bill_property_change(event, _("External link"), None, "{link}".format(link=event.val_after | escape) | safe | em_surround) }} - {% elif event.prop_changed == "owers_added" %} - {{ owers_changed(event, True)}} - {% elif event.prop_changed == "owers_removed" %} - {{ owers_changed(event, False)}} - {% elif event.prop_changed == "payer" %} - {{ bill_property_change(event, _("Payer"))}} - {% elif event.prop_changed == "amount" %} - {{ bill_property_change(event, _("Amount")) }} - {% elif event.prop_changed == "date" %} - {{ bill_property_change(event, _("Date")) }} - {% elif event.prop_changed == "original_currency" %} - {{ bill_property_change(event, _("Currency")) }} - {% elif event.prop_changed == "converted_amount" %} - {{ bill_property_change(event, _("Amount in %(currency)s", currency=g.project.default_currency)) }} - {% else %} - {% if event.object_type == "Bill" %} + {% elif event.prop_changed == "external_link" %} + {{ bill_property_change(event, _("External link"), None, "{link}".format(link=event.val_after | escape) | safe | em_surround) }} + {% elif event.prop_changed == "owers_added" %} + {{ owers_changed(event, True)}} + {% elif event.prop_changed == "owers_removed" %} + {{ owers_changed(event, False)}} + {% elif event.prop_changed == "payer" %} + {{ bill_property_change(event, _("Payer"))}} + {% elif event.prop_changed == "amount" %} + {{ bill_property_change(event, _("Amount")) }} + {% elif event.prop_changed == "date" %} + {{ bill_property_change(event, _("Date")) }} + {% elif event.prop_changed == "original_currency" %} + {{ bill_property_change(event, _("Currency")) }} + {% elif event.prop_changed == "converted_amount" %} + {{ bill_property_change(event, _("Amount in %(currency)s", currency=g.project.default_currency)) }} + {% else %} {% trans %}Bill {{ name }} modified{% endtrans %} - {% elif event.object_type == "Person" %} + {% endif %} + {% elif event.object_type == "Person" %} + {% if event.prop_changed == "activated" %} + {% if event.val_after == False %} + {% trans %}Participant {{ name }} deactivated{% endtrans %} + {% else %} + {% trans %}Participant {{ name }} reactivated{% endtrans %} + {% endif %} + {% elif event.prop_changed == "name" %} + {% set new_name=event.val_after|em_surround %} + {% trans %}Participant {{ name }} renamed to {{ new_name }}{% endtrans %} + {% elif event.prop_changed == "weight" %} + {% set old_weight=event.val_before|em_surround %} + {% set new_weight=event.val_after|em_surround %} + {% trans %}Participant {{ name }}: weight changed from {{ old_weight }} to {{ new_weight }}{% endtrans %} + {% else %} {% trans %}Participant {{ name }} modified{% endtrans %} {% endif %} {% endif %}