From bcc2e4fcec619078059102dbd5c8172010390a46 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Mon, 15 Apr 2013 00:59:59 +0200 Subject: Some reorganizing --- templates/expenses/show.jinja | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 templates/expenses/show.jinja (limited to 'templates/expenses/show.jinja') diff --git a/templates/expenses/show.jinja b/templates/expenses/show.jinja new file mode 100644 index 0000000..2643ac4 --- /dev/null +++ b/templates/expenses/show.jinja @@ -0,0 +1,62 @@ +{% extends "layout.jinja" %} +{% from "macros.jinja" import left_arrow, right_arrow, colorize %} + +{% block heading %} + {% if exps | length > 1 %} + Aktuelle Kosten + {% else %} + Kosten für {{exps[0]|date}} + {% endif %} +{% endblock %} + +{% block js %} + {{ super() }} + +{% endblock %} + +{% block content %} + {% for e in exps %} + {% if exps | length > 1 %}

{{e|date}}

{% endif %} + {% for c in e.catexps | sort(attribute="cat.name") %} + {% call(exp) detail(name=c.cat.name, sum=c.expense, set=c.all) %} + {{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur }} + {% endcall %} + {% endfor %} + + {% call(exp) detail(name="Constant", sum=e.constsum, set=e.consts) %} + {{exp.monthly}} -- {{exp.description}} + {% endcall %} + + {% call(exp) detail(name="In Summa", sum=e.sum, set=e.all, color="#ff2d2d") %} + {{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur}} + {% endcall %} +
+ {% endfor %} + + {# Note: exps are given _reversed_, i.e. "exps | last" is + the _first_ on the timeline #} + {% set d = exps | last | prev_date | date %} + {{ left_arrow(url_for(".show_date_str", p = d), d) }} + + {% set first = exps | first %} + {% if not first is last_date %} + {% set d = first | next_date | date %} + {{ right_arrow(url_for(".show_date_str", p = d), d) }} + {% endif %} +{% endblock content %} + +{% macro detail(name, sum, set, color=None) %} +
+ + {% call colorize(fgcolor=color) %} + {{name}}: {{sum | eur}}
+ {% endcall %} +
+
    + {% for exp in set %} +
  • {{ caller(exp) }}
  • + {% endfor %} +
+
+
+{% endmacro %} -- cgit v1.2.3-70-g09d2