home · contact · privacy
Further refine balance layout.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 27 Jan 2025 06:46:45 +0000 (07:46 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 27 Jan 2025 06:46:45 +0000 (07:46 +0100)
ledger.py
templates/_base.tmpl
templates/_macros.tmpl
templates/balance.tmpl

index 8968a4d5a701b45727c18c519bdb47ae0ad74a5b..7a62924328642d863f58c0f4e2f1cc46257b4a57 100755 (executable)
--- a/ledger.py
+++ b/ledger.py
@@ -68,13 +68,6 @@ class Account:
         if self.parent:
             self.parent.children += [self]
 
-    @property
-    def full_name(self) -> str:
-        """Return full account path."""
-        if self.parent:
-            return f'{self.parent.full_name}:{self.basename}'
-        return self.basename
-
     @property
     def wealth(self) -> Wealth:
         """Total of .local_wealth with that of .children."""
index 034c58d66e05622b44b40b2949c4a8d4303675af..0ec782d16390344c36ecfa6b63e665e1c9db2a59 100644 (file)
@@ -8,8 +8,8 @@
 </script>
 <style>
 body { background-color: white; font-family: sans-serif; }
-tr:nth-child(odd) { background-color: #dcdcdc; }
-tr:nth-child(even) { background-color: #ffffff; }
+tr.alternating:nth-child(odd) { background-color: #dcdcdc; }
+tr.alternating:nth-child(even) { background-color: #ffffff; }
 td { text-align: left; vertical-align: top; }
 span.warning, table.warning tbody tr td, tr.warning td { background-color: #ff8888; }
 {% block css %}{% endblock %}
index d09643bb1d510e5dc4a35bd1f10d053a0ed3eb24..0dfd2fc742ea8f5d79796c82197a1822e34d1f94 100644 (file)
@@ -11,9 +11,9 @@ td.invalid, tr.warning td.invalid { background-color: #ff0000; }
 <table>
 {% for dat_line in dat_lines %}
   {% if (not raw) and dat_line.is_intro and loop.index > 1 %}
-    <tr><td colspan=5>&nbsp;</td></tr>
+    <tr class="alternating"><td colspan=5>&nbsp;</td></tr>
   {% endif %}
-  <tr{% if dat_line.is_questionable %} class="warning"{% endif %}>
+  <tr class="alternating{% if dat_line.is_questionable %} warning{% endif %}">
   {% if dat_line.is_intro %}
     <td id="{{dat_line.booking_id}}"><a href="#{{dat_line.booking_id}}">#</a>/<a href="/balance?cutoff={{dat_line.booking_id+1}}">b</a></td>
   {% else %}
@@ -42,7 +42,7 @@ td.invalid, tr.warning td.invalid { background-color: #ff0000; }
   {% endif %}
   </tr>
   {% if dat_line.error and not raw %}
-    <tr class="warning">
+    <tr class="alternating warning">
     <td></td>
     <td class="invalid" colspan=3>{{dat_line.error}}</td>
     <td></td>
index bcb595131a0a0105c0292724a96cd753d57079fa..8bf74fb5c2e27193375eaedac45432b139603e4b 100644 (file)
@@ -1,33 +1,47 @@
 {% extends '_base.tmpl' %}
 
+
 {% macro account_with_children(account, indent) %}
-  <tr>
-  {% for curr, amt in account.wealth.moneys.items() %}
-    {% if 1 == loop.index %}
-      <td class="amt">{{amt}}</td>
-      <td class="curr">{{curr|truncate(4,true,"…")}}</td>
-    {% endif %}
-  {% endfor %}
-  <td>{{account.full_name}}{% if account.children %}:…{% endif %}</td>
-  </tr>
-  {% if account.wealth.moneys|length > 1 %}
-  <tr>
-  <td colspan=2>
-  <details><summary>other currencies</summary>
-  <table>
-  {% for curr, amt in account.wealth.moneys.items() %}
-    {% if 1 < loop.index %}
+  <tr class="alternating">
+  <td class="money">
+  {% if account.wealth.moneys|length == 1 %}
+    <table>
+    {% for curr, amt in account.wealth.moneys.items() %}
       <tr>
       <td class="amt">{{amt}}</td>
       <td class="curr">{{curr|truncate(4,true,"…")}}</td>
       </tr>
-    {% endif %}
-  {% endfor %}
-  </table>
-  </details>
-  <td>
-  </tr>
+    {% endfor %}
+    </table>
+  {% else %}
+    <details>
+    <summary>
+    <table class="summary">
+    {% 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>
+      {% endif %}
+    {% endfor %}
+    </table>
+    </summary>
+    <table>
+    {% 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>
+      {% endif %}
+    {% endfor %}
+    </table>
+    </details>
   {% endif %}
+  </td>
+  <td class="acc">{% for i in range(indent) %}&nbsp; &nbsp; {% endfor %}{% if account.parent %}:{% endif %}{{account.basename}}{% if account.children %}:{% endif %}</td>
+  </tr>
   {% for child in account.children %}
     {{ account_with_children(child, indent=indent+1) }}
   {% endfor %}
 
 {% block css %}
 {{ macros.css_td_money() }}
+td.amt { width: 10em; }
+td.curr { width: 3em; }
+table.summary { float: left; }
+td.money { padding-right: 1em; }
 {% endblock css %}
 
 {% block content %}