parent
805c7d3dc0
commit
e1f29f90c6
9 changed files with 53 additions and 23 deletions
|
@ -16,6 +16,9 @@
|
||||||
<section>
|
<section>
|
||||||
<h3>{% translate "Transactions" %}</h3>
|
<h3>{% translate "Transactions" %}</h3>
|
||||||
{% url "category_transactions" category.id as t_url %}
|
{% url "category_transactions" category.id as t_url %}
|
||||||
|
<p>
|
||||||
|
<a class="big-link" href="{{ t_url }}">{{ "list-check"|remixnl }}{% translate "View all transactions" %}</a>
|
||||||
|
</p>
|
||||||
{% transaction_table category.transaction_set.all n_max=8 transactions_url=t_url %}
|
{% transaction_table category.transaction_set.all n_max=8 transactions_url=t_url %}
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -522,7 +522,8 @@ ul.statements {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.category {
|
.category,
|
||||||
|
.big-link {
|
||||||
padding: 0 var(--gap);
|
padding: 0 var(--gap);
|
||||||
border: var(--gray) 1px solid;
|
border: var(--gray) 1px solid;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
|
|
|
@ -45,9 +45,7 @@ table {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tfoot tr:not(.new) {
|
|
||||||
background: var(--bg-01);
|
|
||||||
}
|
|
||||||
.l {
|
.l {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
{% load i18n transaction_extras %}
|
{% load i18n main_extras transaction_extras %}
|
||||||
{% if page_obj %}
|
{% if page_obj %}
|
||||||
<p class="pagination">
|
<p class="pagination">{% pagination_links page_obj %}</p>
|
||||||
{% for page in paginator.page_range %}
|
|
||||||
<a href="?page={{ page }}"
|
|
||||||
{% if page == page_obj.number %}class="cur"{% endif %}>{{ page }}</a>
|
|
||||||
{% endfor %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if month %}
|
{% if month %}
|
||||||
<p class="pagination">{% year_url month %}</p>
|
<p class="pagination">{% year_url month %}</p>
|
||||||
|
|
13
nummi/main/templates/main/pagination_links.html
Normal file
13
nummi/main/templates/main/pagination_links.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{% load i18n main_extras %}
|
||||||
|
{% if first.show %}
|
||||||
|
<a href="?page=1" class="first">1</a>
|
||||||
|
{% if first.dots %}<span>…</span>{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% for page in pages %}
|
||||||
|
<a href="?page={{ page.number }}"
|
||||||
|
{% if page.current %}class="cur"{% endif %}>{{ page.number }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% if last.show %}
|
||||||
|
{% if last.dots %}<span>…</span>{% endif %}
|
||||||
|
<a href="?page={{ last.number }}" class="last">{{ last.number }}</a>
|
||||||
|
{% endif %}
|
|
@ -89,3 +89,24 @@ def balance(accounts):
|
||||||
return sum(
|
return sum(
|
||||||
statement.value for acc in accounts if (statement := acc.statement_set.first())
|
statement.value for acc in accounts if (statement := acc.statement_set.first())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@register.inclusion_tag("main/pagination_links.html")
|
||||||
|
def pagination_links(page_obj):
|
||||||
|
_n = 3
|
||||||
|
return {
|
||||||
|
"pages": [
|
||||||
|
{"number": p, "current": p == page_obj.number}
|
||||||
|
for p in page_obj.paginator.page_range
|
||||||
|
if abs(p - page_obj.number) < _n
|
||||||
|
],
|
||||||
|
"first": {
|
||||||
|
"show": page_obj.number > _n,
|
||||||
|
"dots": page_obj.number > _n + 1,
|
||||||
|
},
|
||||||
|
"last": {
|
||||||
|
"show": page_obj.number <= page_obj.paginator.num_pages - _n,
|
||||||
|
"dots": page_obj.number < page_obj.paginator.num_pages - _n,
|
||||||
|
"number": page_obj.paginator.num_pages,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -56,8 +56,12 @@
|
||||||
<section>
|
<section>
|
||||||
<h3>{% translate "Transactions" %}</h3>
|
<h3>{% translate "Transactions" %}</h3>
|
||||||
{% url "statement_transactions" statement.id as t_url %}
|
{% url "statement_transactions" statement.id as t_url %}
|
||||||
{% url "new_transaction" statement=statement.id as nt_url %}
|
<p>
|
||||||
{% transaction_table statement.transaction_set.all n_max=8 transactions_url=t_url new_transaction_url=nt_url %}
|
<a class="big-link"
|
||||||
|
href="{% url "new_transaction" statement=statement.id %}">{{ "add-circle"|remix }}{% translate "Add transaction" %}</a>
|
||||||
|
<a class="big-link" href="{{ t_url }}">{{ "list-check"|remixnl }}{% translate "View all transactions" %}</a>
|
||||||
|
</p>
|
||||||
|
{% transaction_table statement.transaction_set.all n_max=8 transactions_url=t_url %}
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h3>{% translate "Categories" %}</h3>
|
<h3>{% translate "Categories" %}</h3>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "main/list.html" %}
|
{% extends "main/list.html" %}
|
||||||
{% load i18n transaction_extras %}
|
{% load i18n main_extras transaction_extras %}
|
||||||
{% block name %}
|
{% block name %}
|
||||||
{% translate "Transactions" %}
|
{% translate "Transactions" %}
|
||||||
{% endblock name %}
|
{% endblock name %}
|
||||||
|
@ -7,6 +7,8 @@
|
||||||
{% translate "Transactions" %}
|
{% translate "Transactions" %}
|
||||||
{% endblock h2 %}
|
{% endblock h2 %}
|
||||||
{% block table %}
|
{% block table %}
|
||||||
{% url "new_transaction" as nt_url %}
|
<p>
|
||||||
{% transaction_table transactions new_transaction_url=nt_url %}
|
<a class="big-link" href="{% url "new_transaction" %}">{{ "add-circle"|remix }}{% translate "Add transaction" %}</a>
|
||||||
|
</p>
|
||||||
|
{% transaction_table transactions %}
|
||||||
{% endblock table %}
|
{% endblock table %}
|
||||||
|
|
|
@ -13,13 +13,6 @@
|
||||||
{% if not hide_account %}<col class="desc">{% endif %}
|
{% if not hide_account %}<col class="desc">{% endif %}
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
{% if new_transaction_url %}
|
|
||||||
<tr class="new">
|
|
||||||
<td colspan="{{ ncol }}">
|
|
||||||
<a href="{{ new_transaction_url }}">{% translate "Create transaction" %}</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ "attachment"|remix }}</th>
|
<th>{{ "attachment"|remix }}</th>
|
||||||
<th>{% translate "Date" %}</th>
|
<th>{% translate "Date" %}</th>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue