diff --git a/nummi/main/models.py b/nummi/main/models.py index 1b10892..073fafd 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -22,6 +22,12 @@ class Category(models.Model): for child in self.__class__.objects.filter(parent=self): child.save() + @property + def tree(self): + if self.parent is None: + return [self.name] + return self.parent.tree + [self.name] + class Meta: ordering = ["full_name"] diff --git a/nummi/main/static/css/index.css b/nummi/main/static/css/index.css index c10a94b..988dcc6 100644 --- a/nummi/main/static/css/index.css +++ b/nummi/main/static/css/index.css @@ -13,6 +13,7 @@ #transactions > div > * { padding: 1em; + white-space: nowrap; } #transactions > div.g> * { background: var(--bg-01); @@ -23,22 +24,17 @@ color: var(--text-inv); } -#transactions > div > .date, -#transactions > div > .category, -#transactions > div > .trader { +#transactions > div > .center { text-align: center; } #transactions > div > .value { text-align: right; } -#transactions > div > .value, -#transactions > div > .date { +#transactions > div > .num { font-feature-settings: "tnum", "ss01"; } -#transactions > div > span.description, -#transactions > div > span.name { - white-space: nowrap; +#transactions > div > span.text { overflow: hidden; text-overflow: ellipsis; } diff --git a/nummi/main/templates/main/index.html b/nummi/main/templates/main/index.html index c12c07d..f28430b 100644 --- a/nummi/main/templates/main/index.html +++ b/nummi/main/templates/main/index.html @@ -24,12 +24,12 @@ {% for trans in transactions %}
- {{ trans.date|date:"Y-m-d" }} - {{ trans.name }} - {{ trans.value|floatformat:"2g" }} € - {{ trans.trader|default_if_none:"–" }} - {% if trans.category %}{{ trans.category.name }}{% else %}–{% endif %} - {{ trans.description }} + {{ trans.date|date:"Y-m-d" }} + {{ trans.name }} + {{ trans.value|floatformat:"2g" }} € + {{ trans.trader|default_if_none:"–" }} + {% if trans.category %}{{ trans.category.tree|join:" → " }}{% else %}–{% endif %} + {{ trans.description }}
{% endfor %}