From 2816a4a325764d53abaf5c89958d1f88ca86c985 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 6 Feb 2018 18:12:09 +0100 Subject: [PATCH] Make bill views use transformer object. --- resources/views/bills/index.twig | 1 - resources/views/bills/show.twig | 35 ++++++++++++------------- resources/views/list/bills.twig | 44 ++++++++++++++++---------------- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/resources/views/bills/index.twig b/resources/views/bills/index.twig index 40b5e5c5ea..27d6a93168 100644 --- a/resources/views/bills/index.twig +++ b/resources/views/bills/index.twig @@ -26,7 +26,6 @@
{{ 'create_new_bill'|_ }}
-


{% include 'list/bills' %} diff --git a/resources/views/bills/show.twig b/resources/views/bills/show.twig index 1742fd3a6c..f824d8da9c 100644 --- a/resources/views/bills/show.twig +++ b/resources/views/bills/show.twig @@ -10,14 +10,14 @@
-

{{ bill.name }}

+

{{ object.name }}

@@ -28,18 +28,18 @@ {{ 'matching_on'|_ }} - {% for word in bill.match|split(',') %} + {% for word in object.match %} {{ word }} {% endfor %} - {{ trans('firefly.between_amounts', {low: bill.amount_min|formatAmount, high: bill.amount_max|formatAmount })|raw }} + {{ trans('firefly.between_amounts', {low: object.amount_min|formatAmount, high: object.amount_max|formatAmount })|raw }} {{ 'repeats'|_ }} - {{ trans('firefly.repeat_freq_' ~bill.repeat_freq) }}. + {{ trans('firefly.repeat_freq_' ~object.repeat_freq) }}. {{ 'bill_is_active'|_ }} - {% if bill.active %} + {% if object.active %} {{ 'yes'|_ }} {% else %} {{ 'no'|_ }} @@ -49,21 +49,20 @@ {{ 'bill_will_automatch'|_ }} - {% if bill.automatch %} + {% if object.automatch %} {{ 'yes'|_ }} {% else %} {{ 'no'|_ }} {% endif %} - {{ 'next_expected_match'|_ }} - {% if bill.nextExpectedMatch %} - {{ bill.nextExpectedMatch.formatLocalized(monthAndDayFormat) }} - {% else %} - {{ 'unknown'|_ }} + {% if object.next_expected_match|length > 0 %} + {{ formatDate(object.next_expected_match, monthAndDayFormat) }} + {% else %} + {{ 'unknown'|_ }} {% endif %} @@ -85,21 +84,21 @@

{{ 'more'|_ }}

- {% if bill.notes.count == 1 %} + {% if object.notes|length > 0 %} - +
{{ trans('list.notes') }}{{ bill.notes.first.text|markdown }}{{ object.notes|markdown }}
{% endif %}
- {% if bill.attachments|length > 0 %} + {% if object.attachments_count > 0 %}

{{ 'attachments'|_ }}

@@ -171,7 +170,7 @@ {% block scripts %} diff --git a/resources/views/list/bills.twig b/resources/views/list/bills.twig index 0566938b1c..70fc2d5b27 100644 --- a/resources/views/list/bills.twig +++ b/resources/views/list/bills.twig @@ -1,5 +1,5 @@
- {{ bills.render|raw }} + {{ paginator.render|raw }}
@@ -26,13 +26,13 @@ - @@ -49,44 +49,44 @@ {# paidDates = 0 (bill not paid in period) - payDates = 0 (bill not expected to be paid in this period) + pay_dates = 0 (bill not expected to be paid in this period) bill is active. #} - {% if entry.paidDates.count() == 0 and entry.payDates.count() == 0 and entry.active %} + {% if entry.paid_dates|length == 0 and entry.pay_dates|length == 0 and entry.active %} - {% endif %} {# - paidDates = 0 (bill not paid in period) - payDates > 0 (bill IS expected to be paid in this period) + paid_dates = 0 (bill not paid in period) + pay_dates > 0 (bill IS expected to be paid in this period) bill is active #} - {% if entry.paidDates.count() == 0 and entry.payDates.count() > 0 and entry.active %} + {% if entry.paid_dates|length == 0 and entry.pay_dates|length > 0 and entry.active %} - {% endif %} {# - paidDates >= 0 (bill is paid X times). - Don't care about payDates. + paid_dates >= 0 (bill is paid X times). + Don't care about pay_dates. #} - {% if entry.paidDates.count() > 0 and entry.active %} - - {% endif %} {# bill is not active #} @@ -124,5 +124,5 @@
{{ entry.name }} {# count attachments #} - {% if entry.attachments.count > 0 %} + {% if entry.attachments_count > 0 %} {% endif %}
- {{ bills.render|raw }} + {{ paginator.render|raw }}
\ No newline at end of file