From: Christian Heller Date: Mon, 24 Feb 2025 11:48:36 +0000 (+0100) Subject: Refactor template code. X-Git-Url: https://plomlompom.com/repos/booking/static/%7B%7Bdb.prefix%7D%7D/do_todos?a=commitdiff_plain;h=5c6102bdbde57c23e1547dd4051fb995ebf16fa7;p=ledgplom Refactor template code. --- diff --git a/src/templates/_macros.tmpl b/src/templates/_macros.tmpl index bc98cc1..a1a2764 100644 --- a/src/templates/_macros.tmpl +++ b/src/templates/_macros.tmpl @@ -4,44 +4,49 @@ td.amt, td.curr { font-family: monospace; font-size: 1.3em; } {% endmacro %} + {% macro css_td_money_balance() %} td.balance.amt { width: 10em; } td.balance.curr { width: 3em; } {% endmacro %} + {% macro css_errors() %} td.invalid, tr.warning td.invalid { background-color: #ff0000; } {% endmacro %} + {% macro css_ledger_index_col() %} table.ledger tr > td:first-child { background-color: white; } {% endmacro %} -{% macro tr_money_balance(amt, curr) %} - -{{amt}} -{{curr|truncate(4,true,"…")}} - -{% endmacro %} +{% macro table_dat_lines_action_button(dat_line, verb, direction, label, enabled=true) %} + +{% endmacro %} {% macro table_dat_lines(dat_lines, raw) %}
{% for dat_line in dat_lines %} + + {% if dat_line.is_intro %} - + [#] + {{ table_dat_lines_action_button(dat_line, "move", "up", "^", dat_line.booking.can_move(1)) }} {% elif dat_line.booking_line.idx == 1 %} - + [b] + {{ table_dat_lines_action_button(dat_line, "move", "down", "v", dat_line.booking.can_move(0)) }} {% elif dat_line.booking_line.idx == 2 %} - - {% else %} - + {{ table_dat_lines_action_button(dat_line, "copy", "here", "c") }} + {{ table_dat_lines_action_button(dat_line, "copy", "to_end", "C") }} {% endif %} + + {% if raw %} {% if dat_line.is_intro %} @@ -52,7 +57,9 @@ table.ledger tr > td:first-child { background-color: white; } {% else %} {% if dat_line.is_intro %} - + {{dat_line.booking.target}} {% elif dat_line.error %} @@ -64,17 +71,20 @@ table.ledger tr > td:first-child { background-color: white; } {% else %} - + + {% endif %} {% endif %} - {% if dat_line.error and not raw %} + + {% if (not raw) and dat_line.error %} {% endif %} + {% endfor %}
[#][b]{{dat_line.booking.date}} + {{dat_line.booking.date}} + {{dat_line.comment}}{{dat_line.booking_line.account}} {{dat_line.comment}}{{dat_line.comment}} {{dat_line.comment}} 
{{dat_line.error}}
@@ -108,6 +118,7 @@ function taint() { {% endmacro %} + {% macro edit_bar(target, id) %} prev · next @@ -121,6 +132,14 @@ function taint() { {% endmacro %} + +{% macro tr_money_balance(amt, curr) %} + +{{amt}} +{{curr|truncate(4,true,"…")}} + +{% endmacro %} + {% macro booking_balance_account_with_children(node) %} {{node.name}}{% if node.children %}:{% endif %} @@ -153,6 +172,7 @@ function taint() { {% endmacro %} + {% macro booking_balance(valid, roots) %}