Compare commits

...

2 commits

7 changed files with 20 additions and 9 deletions

View file

@ -14,7 +14,7 @@
{% include "statement/statement_table.html" %}
<h3>{% translate "Transactions" %}</h3>
{% include "transaction/transaction_table.html" %}
{% if history.data %}
{% if history %}
<h3>{% translate "History" %}</h3>
{% include "history/plot.html" %}
{% endif %}

View file

@ -30,6 +30,6 @@ urlpatterns = [
path(
"<account>/history/<int:year>/<int:month>",
TransactionMonthView.as_view(),
name="transaction_month",
name="account_transaction_month",
),
]

View file

@ -23,7 +23,7 @@
<th scope="row" class="l">
{% if cat.category %}
{% if month %}
<a href="{% url "transaction_month" cat.category month.year month.month %}">{{ cat.category__name }}</a>
<a href="{% url "category_transaction_month" cat.category month.year month.month %}">{{ cat.category__name }}</a>
{% else %}
{{ cat.category__name }}
{% endif %}

View file

@ -15,6 +15,6 @@ urlpatterns = [
path(
"<category>/history/<int:year>/<int:month>",
TransactionMonthView.as_view(),
name="transaction_month",
name="category_transaction_month",
),
]

View file

@ -29,9 +29,9 @@
<th class="date" scope="row">
{% if date.has_transactions %}
{% if account %}
<a href="{% url "transaction_month" account=account.pk year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
<a href="{% url "account_transaction_month" account=account.pk year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
{% elif category %}
<a href="{% url "transaction_month" category=category.pk year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
<a href="{% url "category_transaction_month" category=category.pk year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
{% else %}
<a href="{% url "transaction_month" year=date.month.year month=date.month.month %}">{{ date.month|date:"Y-m" }}</a>
{% endif %}

View file

@ -9,8 +9,14 @@
{% endif %}
{% if month %}
<p class="pagination">
<a href="{% url "transaction_month" previous_month|date:"Y" previous_month|date:"m" %}">{{ previous_month|date:"F Y"|capfirst }}</a>
<a href="" class="cur">{{ month|date:"F Y"|capfirst }}</a>
<a href="{% url "transaction_month" next_month|date:"Y" next_month|date:"m" %}">{{ next_month|date:"F Y"|capfirst }}</a>
{% with month=previous_month %}
{% include "main/pagination_month.html" %}
{% endwith %}
{% with cur=True %}
{% include "main/pagination_month.html" %}
{% endwith %}
{% with month=next_month %}
{% include "main/pagination_month.html" %}
{% endwith %}
</p>
{% endif %}

View file

@ -0,0 +1,5 @@
{% load i18n %}
{% if month %}
<a {% if cur %}class="cur"{% endif %}
href="{% if account %}{% url "account_transaction_month" account.id month|date:"Y" month|date:"m" %}{% elif category %}{% url "category_transaction_month" category.id month|date:"Y" month|date:"m" %}{% else %}{% url "transaction_month" month|date:"Y" month|date:"m" %}{% endif %}">{{ month|date:"F Y"|capfirst }}</a>
{% endif %}