home
·
contact
·
privacy
projects
/
plomledger
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6f8fc0a
)
Refactor templates, improve values display in /balance.
master
author
Christian Heller
<c.heller@plomlompom.de>
Wed, 22 Jan 2025 15:32:08 +0000
(16:32 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Wed, 22 Jan 2025 15:32:08 +0000
(16:32 +0100)
templates/_base.tmpl
patch
|
blob
|
history
templates/_macros.tmpl
patch
|
blob
|
history
templates/balance.tmpl
patch
|
blob
|
history
templates/booking.tmpl
patch
|
blob
|
history
templates/index.tmpl
patch
|
blob
|
history
templates/raw.tmpl
patch
|
blob
|
history
diff --git
a/templates/_base.tmpl
b/templates/_base.tmpl
index 75f33afd8ab3aebe73e8599cf1d60ab8ffa7f71e..8b8dccfbd3fae3da50ac1969208357877c9c71ad 100644
(file)
--- a/
templates/_base.tmpl
+++ b/
templates/_base.tmpl
@@
-6,8
+6,6
@@
<style>
body { background-color: white; font-family: sans-serif; }
tr:nth-child(odd) { background-color: #dcdcdc; }
<style>
body { background-color: white; font-family: sans-serif; }
tr:nth-child(odd) { background-color: #dcdcdc; }
-tr.warning td { background-color: #ff8888; }
-td.invalid, tr.warning td.invalid { background-color: #ff0000; }
{% block css %}{% endblock %}
</style>
</head>
{% block css %}{% endblock %}
</style>
</head>
diff --git
a/templates/_macros.tmpl
b/templates/_macros.tmpl
index 106e443ab0bb1daafee88063af175c67977fee64..2342215132e71832fc29cd56edde915db5109920 100644
(file)
--- a/
templates/_macros.tmpl
+++ b/
templates/_macros.tmpl
@@
-1,7
+1,12
@@
-{% macro css_
value_line
() %}
+{% macro css_
td_money
() %}
td.amt { text-align: right }
td.amt, td.curr { font-family: monospace; font-size: 1.3em; }
td.amt { text-align: right }
td.amt, td.curr { font-family: monospace; font-size: 1.3em; }
-td.curr { text-align: center; }
+td.curr { text-align: left; }
+{% endmacro %}
+
+{% macro css_errors() %}
+tr.warning td { background-color: #ff8888; }
+td.invalid, tr.warning td.invalid { background-color: #ff0000; }
{% endmacro %}
{% macro table_dat_lines(dat_lines, single, raw) %}
{% endmacro %}
{% macro table_dat_lines(dat_lines, single, raw) %}
diff --git
a/templates/balance.tmpl
b/templates/balance.tmpl
index da13b344e3163c037932589e556b2fb20a8a43b6..856b55533fd1eb3843b8918c127e5c0ed8c24969 100644
(file)
--- a/
templates/balance.tmpl
+++ b/
templates/balance.tmpl
@@
-1,21
+1,33
@@
{% extends '_base.tmpl' %}
{% extends '_base.tmpl' %}
-
{% macro account_with_children(account, indent) %}
<tr>
{% macro account_with_children(account, indent) %}
<tr>
-<td>{% for _ in range(indent) %} {% endfor %}{{account.basename}}</td>
-<td>
{% for curr, amt in account.wealth.moneys.items() %}
{% for curr, amt in account.wealth.moneys.items() %}
-{{amt}}{{curr}}
+{% if 1 == loop.index %}
+<td class="amt">{{amt}}</td>
+<td class="curr">{{curr|truncate(4,true,"…")}}</td>
+{% endif %}
{% endfor %}
{% endfor %}
-</td>
+<td>{% for _ in range(indent) %} {% endfor %}{{account.basename}}</td>
+</tr>
+{% for curr, amt in account.wealth.moneys.items() %}
+{% if 1 < loop.index %}
+<tr>
+<td class="amt">{{amt}}</td>
+<td class="curr">{{curr|truncate(4,true,"…")}}</td>
</tr>
</tr>
+{% endif %}
+{% endfor %}
{% for child in account.children %}
{{ account_with_children(child, indent=indent+1) }}
{% endfor %}
{% endmacro %}
{% for child in account.children %}
{{ account_with_children(child, indent=indent+1) }}
{% endfor %}
{% endmacro %}
+{% block css %}
+{{ macros.css_td_money() }}
+{% endblock css %}
+
{% block content %}
<table>
{% for root in roots %}
{% block content %}
<table>
{% for root in roots %}
diff --git
a/templates/booking.tmpl
b/templates/booking.tmpl
index 86273b9e23a11f8fec60b7234c87df790464d25f..2e01a75c0e95326c0e3b11e8e6e762273c509888 100644
(file)
--- a/
templates/booking.tmpl
+++ b/
templates/booking.tmpl
@@
-1,7
+1,9
@@
{% extends '_base.tmpl' %}
{% extends '_base.tmpl' %}
+
{% block css %}
{% block css %}
-{{ macros.css_value_line() }}
+{{ macros.css_td_money() }}
+{{ macros.css_errors() }}
{% endblock %}
{% block content %}
{% endblock %}
{% block content %}
diff --git
a/templates/index.tmpl
b/templates/index.tmpl
index fc24e6e9f73918384c66d9995dd8d07a1f9ad2e3..43be0f46ad0221cec1b19d95ed4db21f7139f7cf 100644
(file)
--- a/
templates/index.tmpl
+++ b/
templates/index.tmpl
@@
-1,7
+1,9
@@
{% extends '_base.tmpl' %}
{% extends '_base.tmpl' %}
+
{% block css %}
{% block css %}
-{{ macros.css_value_line() }}
+{{ macros.css_td_money() }}
+{{ macros.css_errors() }}
{% endblock %}
{% block content %}
{% endblock %}
{% block content %}
diff --git
a/templates/raw.tmpl
b/templates/raw.tmpl
index 6851d939a93bb1919d7d9575db910be58cc8f946..8b2d621eaead3b7db33b7b31076eb4ebe268ba02 100644
(file)
--- a/
templates/raw.tmpl
+++ b/
templates/raw.tmpl
@@
-1,7
+1,9
@@
{% extends '_base.tmpl' %}
{% extends '_base.tmpl' %}
+
{% block css %}
table { font-family: monospace; }
{% block css %}
table { font-family: monospace; }
+{{ macros.css_errors() }}
{% endblock %}
{% block content %}
{% endblock %}
{% block content %}