From 28ac9c8ef7e616dec285689ae917e50bf0a09625 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 30 Dec 2024 17:29:42 +0100 Subject: [PATCH] Improve calendar table --- nummi/history/templates/history/plot.html | 8 +++++--- nummi/history/templatetags/history_extras.py | 5 +++++ nummi/main/static/main/css/plot.css | 10 +++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/nummi/history/templates/history/plot.html b/nummi/history/templates/history/plot.html index bd7c2e6..ecf24ed 100644 --- a/nummi/history/templates/history/plot.html +++ b/nummi/history/templates/history/plot.html @@ -3,13 +3,14 @@ {% load transaction_extras %} {% load i18n %}
- +
{% if not year %} {% endif %} {% calendar_head %} + @@ -24,16 +25,17 @@ {% empty_calendar_cells_start m.month.month %} {% endif %} {% if m %} - {% else %} - + {% endif %} {% if forloop.parentloop.first and forloop.last %} {% empty_calendar_cells_end m.month.month %} {% endif %} {% endfor %} + {% endfor %} diff --git a/nummi/history/templatetags/history_extras.py b/nummi/history/templatetags/history_extras.py index 7a83898..8ad71bf 100644 --- a/nummi/history/templatetags/history_extras.py +++ b/nummi/history/templatetags/history_extras.py @@ -60,3 +60,8 @@ def calendar_head(): th = (f"""""" for month in months) return mark_safe("".join(th)) + + +@register.filter +def sum_year(y_data): + return sum(y["sum"] for y in y_data) diff --git a/nummi/main/static/main/css/plot.css b/nummi/main/static/main/css/plot.css index ecc1fdc..c1f0756 100644 --- a/nummi/main/static/main/css/plot.css +++ b/nummi/main/static/main/css/plot.css @@ -95,13 +95,16 @@ table.full-width col.bar { border-top: none; } - td { + td.month { text-align: center; background-color: color-mix( in hsl, var(--td-bg, var(--bg)) var(--opacity), var(--bg) ); + padding: 0; + width: 4rem; + height: 4rem; &.p { --td-bg: var(--green); } @@ -109,6 +112,11 @@ table.full-width col.bar { --td-bg: var(--red); } } + td.total { + text-align: right; + font-weight: 650; + font-feature-settings: var(--num); + } } } }
{% translate "Year" %}{% translate "Total" %}
{% up_down_icon m.sum %}{{ y_data|sum_year|pmrvalue }}
{month:02d}