Include icons in links

This commit is contained in:
Edgar P. Burkhart 2024-12-31 15:14:42 +01:00
parent fac26bc224
commit c754e869fc
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
4 changed files with 22 additions and 34 deletions

View file

@ -4,14 +4,13 @@
<table class="full-width"> <table class="full-width">
<colgroup> <colgroup>
<col class="desc"> <col class="desc">
<col class="icon">
<col class="value"> <col class="value">
<col span="2" class="bar"> <col span="2" class="bar">
<col class="value"> <col class="value">
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th scope="col" colspan="2">{% translate "Category" %}</th> <th scope="col">{% translate "Category" %}</th>
<th scope="col" colspan="2">{% translate "Expenses" %}</th> <th scope="col" colspan="2">{% translate "Expenses" %}</th>
<th scope="col" colspan="2">{% translate "Income" %}</th> <th scope="col" colspan="2">{% translate "Income" %}</th>
</tr> </tr>
@ -23,17 +22,14 @@
<th scope="row" class="l"> <th scope="row" class="l">
{% if cat.category %} {% if cat.category %}
{% if month %} {% if month %}
<a href="{% url "category_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__icon|remix }}{{ cat.category__name }}</a>
{% elif year %} {% elif year %}
<a href="{% url "category_transaction_year" cat.category year.year %}">{{ cat.category__name }}</a> <a href="{% url "category_transaction_year" cat.category year.year %}">{{ cat.category__icon|remix }}{{ cat.category__name }}</a>
{% else %} {% else %}
{{ cat.category__name }} {{ cat.category__icon|remix }}{{ cat.category__name }}
{% endif %} {% endif %}
{% endif %} {% endif %}
</th> </th>
<td class="c">
{% if cat.category %}{{ cat.category__icon|remix }}{% endif %}
</td>
<td class="value">{{ cat.sum_m|pmvalue }}</td> <td class="value">{{ cat.sum_m|pmvalue }}</td>
<td class="bar m"> <td class="bar m">
{% if cat.sum_m %} {% if cat.sum_m %}
@ -59,7 +55,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td class="empty" colspan="6">{% translate "No transaction" %}</td> <td class="empty" colspan="5">{% translate "No transaction" %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endspaceless %} {% endspaceless %}
@ -67,7 +63,7 @@
<tfoot> <tfoot>
{% if categories %} {% if categories %}
<tr> <tr>
<th scope="row" colspan="2" class="l">{% translate "Total" %}</th> <th scope="row" class="l">{% translate "Total" %}</th>
<td class="value">{{ total_m|pmvalue }}</td> <td class="value">{{ total_m|pmvalue }}</td>
<td class="bar m"> <td class="bar m">
<div style="width: {% widthratio total_m max -100 %}%"></div> <div style="width: {% widthratio total_m max -100 %}%"></div>

View file

@ -78,9 +78,6 @@ a {
height: 1.5rem; height: 1.5rem;
line-height: 1.5rem; line-height: 1.5rem;
[class^="ri-"] {
margin-right: 0.5em;
}
&.add { &.add {
color: var(--text-link); color: var(--text-link);
background: var(--bg-01); background: var(--bg-01);
@ -391,9 +388,6 @@ ul.statements {
text-overflow: "."; text-overflow: ".";
white-space: nowrap; white-space: nowrap;
} }
a span::after {
content: "\a0";
}
} }
&.new, &.new,
@ -402,3 +396,9 @@ ul.statements {
} }
} }
} }
a {
& > span[class^="ri-"]:first-child::after {
content: "\2002";
}
}

View file

@ -9,14 +9,8 @@
<col class="value"> <col class="value">
<col class="value"> <col class="value">
<col class="desc"> <col class="desc">
{% if not category %} {% if not category %}<col class="desc">{% endif %}
<col class="icon"> {% if not account %}<col class="desc">{% endif %}
<col class="desc">
{% endif %}
{% if not account %}
<col class="icon">
<col class="desc">
{% endif %}
</colgroup> </colgroup>
<thead> <thead>
{% if new_transaction_url %} {% if new_transaction_url %}
@ -34,10 +28,10 @@
<th>{% translate "Income" %}</th> <th>{% translate "Income" %}</th>
<th>{% translate "Trader" %}</th> <th>{% translate "Trader" %}</th>
{% if not category %} {% if not category %}
<th colspan="2">{% translate "Category" %}</th> <th>{% translate "Category" %}</th>
{% endif %} {% endif %}
{% if not account %} {% if not account %}
<th colspan="2">{% translate "Account" %}</th> <th>{% translate "Account" %}</th>
{% endif %} {% endif %}
</tr> </tr>
</thead> </thead>
@ -67,18 +61,16 @@
<td>{{ trans.trader|default_if_none:"" }}</td> <td>{{ trans.trader|default_if_none:"" }}</td>
{% if not category %} {% if not category %}
{% if trans.category %} {% if trans.category %}
<td class="r">{{ trans.category.icon|remix }}</td>
<td> <td>
<a href="{{ trans.category.get_absolute_url }}">{{ trans.category }}</a> <a href="{{ trans.category.get_absolute_url }}">{{ trans.category.icon|remix }}{{ trans.category }}</a>
</td> </td>
{% else %} {% else %}
<td colspan="2"></td> <td></td>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if not account %} {% if not account %}
<td class="r">{{ trans.account.icon|remix }}</td>
<td> <td>
<a href="{{ trans.account.get_absolute_url }}">{{ trans.account }}</a> <a href="{{ trans.account.get_absolute_url }}">{{ trans.account.icon|remix }}{{ trans.account }}</a>
</td> </td>
{% endif %} {% endif %}
</tr> </tr>

View file

@ -38,9 +38,9 @@ def year_url(context, year, cls=""):
@register.simple_tag(takes_context=True) @register.simple_tag(takes_context=True)
def tr_colspan(context): def tr_colspan(context):
ncol = 10 ncol = 8
if context.get("category"): if context.get("category"):
ncol -= 2 ncol -= 1
if context.get("account"): if context.get("account"):
ncol -= 2 ncol -= 1
return ncol return ncol