summaryrefslogtreecommitdiff
path: root/templates/pages
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2013-04-12 01:32:37 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2013-04-12 01:32:37 +0200
commitabfc1005db0f256ca60823f61b8a904304eb9a4c (patch)
tree87c1f13512cae335759d9bf43dab7fc60c3afec0 /templates/pages
parent978f1a4999937a56bd3861a219bb2d9082ba5de6 (diff)
downloadkosten-abfc1005db0f256ca60823f61b8a904304eb9a4c.tar.gz
kosten-abfc1005db0f256ca60823f61b8a904304eb9a4c.tar.bz2
kosten-abfc1005db0f256ca60823f61b8a904304eb9a4c.zip
In Flask/Jinja: Show / Categories
Diffstat (limited to '')
-rw-r--r--templates/pages/cats.jinja22
-rw-r--r--templates/pages/cats.mako22
-rw-r--r--templates/pages/show.jinja59
-rw-r--r--templates/pages/show.mako73
4 files changed, 81 insertions, 95 deletions
diff --git a/templates/pages/cats.jinja b/templates/pages/cats.jinja
new file mode 100644
index 0000000..1a3d88e
--- /dev/null
+++ b/templates/pages/cats.jinja
@@ -0,0 +1,22 @@
+{% extends "page.jinja" %}
+
+{% block heading %} Kategorien {% endblock %}
+
+{% block js %}
+ {{ super() }}
+ <script type="text/javascript" src="{{ "js/cats.js" | static_url }}"></script>
+{% endblock %}
+
+{% block content %}
+ <form name="categories" method="post">
+ <ul class="arrow">
+ {% for c in cats %}
+ <li><span>{{c.name}}</span><input name="{{c.id}}" type="text" value="{{c.name}}" style="display:none;"></li>
+ {%- endfor %}
+ <div><img id="add" src="{{ "images/add.png" | static_url }}"></div>
+ </ul>
+ <input type="submit">
+ </form>
+ <input id="new" name="n-" style="display:none;" >
+{% endblock %}
+
diff --git a/templates/pages/cats.mako b/templates/pages/cats.mako
deleted file mode 100644
index 0f71921..0000000
--- a/templates/pages/cats.mako
+++ /dev/null
@@ -1,22 +0,0 @@
-<%inherit file="/page.mako" />
-
-<form name="categories" method="post">
- <ul class="arrow">
- % for c in cats:
- <li><span>${c.name}</span><input name="${c.id}" type="text" value="${c.name}" style="display:none;"/></li>
- % endfor
- <div><img id="add" src=${"/static/images/add.png" | url} /></div>
- </ul>
-
- <input type="submit" />
-</form>
-
-<input id="new" name="n-" style="display:none;" />
-<%block name="heading">
- Kategorien
-</%block>
-
-<%block name="js">
- ${parent.js()}
- <script type="text/javascript" src=${"/static/js/cats.js" | url}></script>
-</%block>
diff --git a/templates/pages/show.jinja b/templates/pages/show.jinja
new file mode 100644
index 0000000..e7d340e
--- /dev/null
+++ b/templates/pages/show.jinja
@@ -0,0 +1,59 @@
+{% extends "page.jinja" %}
+
+{% block heading %}
+ {% if exps | length > 1 %}
+ Aktuelle Kosten
+ {% else %}
+ Kosten für {{exps[0]|date}}
+ {% endif %}
+{% endblock %}
+
+{% block js %}
+ {{ super() }}
+ <script type="text/javascript" src="{{ "js/show.js" | static_url }}"></script>
+{% endblock %}
+
+{% block content %}
+ {% for e in exps %}
+ {% if exps | length > 1 %}<h2>{{e|date}}</h2>{% endif %}
+ {% for c in e.catexps | sort(attribute="cat.name") %}
+ {% call(exp) detail(name=c.cat.name, sum=c.expense, set=c.all) %}
+ <a href="{{ url_for(".edit", id = exp.id) }}">{{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur }}</a>
+ {% endcall %}
+ {% endfor %}
+
+ {% call(exp) detail(name="Constant", sum=e.constsum, set=e.consts) %}
+ <a href="{{ url_for("consts.show", id = exp.id) }}">{{exp.monthly}} -- {{exp.description}}</a>
+ {% endcall %}
+
+ {% call(exp) detail(name="In Summa", sum=e.sum, set=e.all, color="#ff2d2d") %}
+ <a href="{{ url_for(".edit", id = exp.id) }}">{{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur}}</a>
+ {% endcall %}
+ <br>
+ {% endfor %}
+
+ {% set d = prev_date(exps | last) %}
+ {{ left_arrow(url_for(".show_date", **d), d | date) }}
+
+ {% if not is_last %}
+ {% set d = next_date(exps | last) %}
+ {{ right_arrow(url_for(".show_date", **d), d | date) }}
+ {% endif %}
+{% endblock content %}
+
+{% macro detail(name, sum, set, color=None) %}
+ <div class="detail">
+ <img class="mark" src="{{ "images/closed.png" | static_url }}">
+ {% call colorize(fgcolor=color) %}
+ <span class="heading">{{name}}:</span> <span class="sum">{{sum | eur}}</span><br>
+ {% endcall %}
+ <div class="details">
+ <ul>
+ {% for exp in set %}
+ <li class="expense">{{ caller(exp) }}</li>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
+{% endmacro %}
+
diff --git a/templates/pages/show.mako b/templates/pages/show.mako
deleted file mode 100644
index 06a9915..0000000
--- a/templates/pages/show.mako
+++ /dev/null
@@ -1,73 +0,0 @@
-<%inherit file="/page.mako" />
-
-% for e in exps:
- % if len(exps) > 1:
- <h2>${get_d(e)}</h2>
- % endif
- % for c in sorted(e.catexps, key = lambda c: c.cat.name):
- <%self:detail name="${c.cat.name}" sum="${c.expense}" set="${c.all}" args="exp">
- <a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense | eur}</a>
- </%self:detail>
- % endfor
-
- <%self:detail name="Constant" sum="${e.constsum}" set="${e.consts}" args="exp">
- <a href=${"/const/%s" % exp.id | url}>${exp.monthly} -- ${exp.description}</a>
- </%self:detail>
-
- <%self:detail name="In Summa" sum="${e.sum}" set="${e.all}" args="exp" color="#ff2d2d">
- <a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense | eur}</a>
- </%self:detail>
- <br/>
-% endfor
-
-<%
- if e.date.month == 1:
- date = "%s/12" % (e.date.year - 1)
- else:
- date = "%s/%s" % (e.date.year, e.date.month - 1)
-%>
-${self.left_arrow(date, date)}
-
-% if not is_last:
- <%
- if e.date.month == 13 - len(exps):
- date = "%s/1" % (e.date.year + 1)
- else:
- date = "%s/%s" % (e.date.year, e.date.month + len(exps))
- %>
- ${self.right_arrow(date, date)}
-% endif
-
-<%block name="heading">
- % if len(exps) > 1:
- Aktuelle Kosten
- % else:
- Kosten für ${get_d(exps[0])}
- % endif
-</%block>
-
-<%def name="get_d(e)">
- ${e.date.year}/${e.date.month}
-</%def>
-
-<%block name="js">
- ${parent.js()}
- <script type="text/javascript" src=${"/static/js/show.js" | url}></script>
-</%block>
-
-<%def name="detail(name, sum, set, color=None)">
- <div class="detail">
- <img class="mark" src=${"/static/images/closed.png" | url} />
- <%self:colorize fgcolor="${color}">
- <span class="heading">${name}:</span> <span class="sum">${sum | eur}</span><br/>
- </%self:colorize>
- <div class="details">
- <ul>
- % for exp in set:
- <li class="expense">${caller.body(exp)}</li>
- % endfor
- </ul>
- </div>
- </div>
-</%def>
-