Update template css

This commit is contained in:
Edgar P. Burkhart 2022-05-20 18:35:14 +02:00
parent 6a763a836d
commit 1acf27cac2
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
3 changed files with 16 additions and 14 deletions

View File

@ -22,6 +22,12 @@ class Category(models.Model):
for child in self.__class__.objects.filter(parent=self): for child in self.__class__.objects.filter(parent=self):
child.save() child.save()
@property
def tree(self):
if self.parent is None:
return [self.name]
return self.parent.tree + [self.name]
class Meta: class Meta:
ordering = ["full_name"] ordering = ["full_name"]

View File

@ -13,6 +13,7 @@
#transactions > div > * { #transactions > div > * {
padding: 1em; padding: 1em;
white-space: nowrap;
} }
#transactions > div.g> * { #transactions > div.g> * {
background: var(--bg-01); background: var(--bg-01);
@ -23,22 +24,17 @@
color: var(--text-inv); color: var(--text-inv);
} }
#transactions > div > .date, #transactions > div > .center {
#transactions > div > .category,
#transactions > div > .trader {
text-align: center; text-align: center;
} }
#transactions > div > .value { #transactions > div > .value {
text-align: right; text-align: right;
} }
#transactions > div > .value, #transactions > div > .num {
#transactions > div > .date {
font-feature-settings: "tnum", "ss01"; font-feature-settings: "tnum", "ss01";
} }
#transactions > div > span.description, #transactions > div > span.text {
#transactions > div > span.name {
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }

View File

@ -24,12 +24,12 @@
</div> </div>
{% for trans in transactions %} {% for trans in transactions %}
<div class="transaction {% cycle 'w' 'g' %}"> <div class="transaction {% cycle 'w' 'g' %}">
<span class="date">{{ trans.date|date:"Y-m-d" }}</span> <span class="date num center">{{ trans.date|date:"Y-m-d" }}</span>
<span class="name"><a href="{% url 'transaction' trans.id %}">{{ trans.name }}</a></span> <span class="name text"><a href="{% url 'transaction' trans.id %}">{{ trans.name }}</a></span>
<span class="value">{{ trans.value|floatformat:"2g" }} €</span> <span class="value num">{{ trans.value|floatformat:"2g" }} €</span>
<span class="trader">{{ trans.trader|default_if_none:"" }}</span> <span class="trader text center">{{ trans.trader|default_if_none:"" }}</span>
<span class="category">{% if trans.category %}{{ trans.category.name }}{% else %}{% endif %}</span> <span class="category text center">{% if trans.category %}{{ trans.category.tree|join:" → " }}{% else %}{% endif %}</span>
<span class="description">{{ trans.description }}</span> <span class="description text">{{ trans.description }}</span>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>