diff --git a/nummi/account/templates/account/account_form.html b/nummi/account/templates/account/account_form.html index bb9f369..93918d4 100644 --- a/nummi/account/templates/account/account_form.html +++ b/nummi/account/templates/account/account_form.html @@ -10,13 +10,11 @@ {% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %} {% block tables %} {% if not form.instance|adding %} - {% if statements %} -

{% translate "Statements" %}

- {% include "statement/statement_table.html" %} - {% endif %} - {% if transactions %} -

{% translate "Transactions" %}

- {% include "transaction/transaction_table.html" %} +

{% translate "Statements" %}

+ {% include "statement/statement_table.html" %} +

{% translate "Transactions" %}

+ {% include "transaction/transaction_table.html" %} + {% if history.data %}

{% translate "History" %}

{% include "history/plot.html" %} {% endif %} diff --git a/nummi/category/templates/category/category_form.html b/nummi/category/templates/category/category_form.html index b97f71b..aa16a70 100644 --- a/nummi/category/templates/category/category_form.html +++ b/nummi/category/templates/category/category_form.html @@ -9,10 +9,8 @@ {% endblock %} {% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %} {% block tables %} - {% if transactions %} -

{% translate "Transactions" %}

- {% include "transaction/transaction_table.html" %} - {% endif %} +

{% translate "Transactions" %}

+ {% include "transaction/transaction_table.html" %} {% if history.data %}

{% translate "History" %}

{% include "history/plot.html" %} diff --git a/nummi/category/views.py b/nummi/category/views.py index 2e2fc1c..36fe0d0 100644 --- a/nummi/category/views.py +++ b/nummi/category/views.py @@ -19,14 +19,17 @@ class CategoryUpdateView(NummiUpdateView): pk_url_kwarg = "category" def get_context_data(self, **kwargs): + _max = 8 data = super().get_context_data(**kwargs) category = data["form"].instance - return data | { - "transactions": category.transaction_set.all()[:8], - "transactions_url": reverse_lazy( + data["transactions"] = category.transaction_set.all()[:_max] + if len(data["transactions"]) == _max: + data["transactions_url"] = reverse_lazy( "category_transactions", args=(category.pk,) - ), + ) + + return data | { "history": history(category.transaction_set), } diff --git a/nummi/main/static/main/css/table.css b/nummi/main/static/main/css/table.css index 1fd4076..ddab001 100644 --- a/nummi/main/static/main/css/table.css +++ b/nummi/main/static/main/css/table.css @@ -47,3 +47,8 @@ th { .date { text-align: center; } +td.empty { + text-align: center; + opacity: 0.8; + font-weight: 300; +} diff --git a/nummi/statement/templates/statement/statement_table.html b/nummi/statement/templates/statement/statement_table.html index ebe81b7..12cdccc 100644 --- a/nummi/statement/templates/statement/statement_table.html +++ b/nummi/statement/templates/statement/statement_table.html @@ -51,6 +51,10 @@ {{ snap.diff|pmvalue }} {{ snap.sum|pmvalue }} + {% empty %} + + {% translate "No transaction" %} + {% endfor %} diff --git a/nummi/transaction/templates/transaction/invoice_table.html b/nummi/transaction/templates/transaction/invoice_table.html index 87b6447..82a4406 100644 --- a/nummi/transaction/templates/transaction/invoice_table.html +++ b/nummi/transaction/templates/transaction/invoice_table.html @@ -11,25 +11,23 @@ {% translate "Delete" %} - {% if transaction.invoices %} - {% for invoice in transaction.invoices %} - - - {{ invoice.name }} - - - {% translate "File" %} [{{ invoice.file|extension }}] + {% for invoice in transaction.invoices %} + + + {{ invoice.name }} + + + {% translate "File" %} [{{ invoice.file|extension }}] + + + {% translate "Delete" %} - - {% translate "Delete" %} - - - {% endfor %} - {% else %} - - {% translate "No invoice" %} - {% endif %} + {% empty %} + + {% translate "No invoice" %} + + {% endfor %} diff --git a/nummi/transaction/templates/transaction/transaction_table.html b/nummi/transaction/templates/transaction/transaction_table.html index fe7c34b..27543d2 100644 --- a/nummi/transaction/templates/transaction/transaction_table.html +++ b/nummi/transaction/templates/transaction/transaction_table.html @@ -64,6 +64,13 @@ {% endif %} + {% empty %} + + + {% translate "No transaction" %} + + {% endfor %}