summaryrefslogtreecommitdiff
path: root/templates/pages
diff options
context:
space:
mode:
Diffstat (limited to 'templates/pages')
-rw-r--r--templates/pages/const.jinja39
-rw-r--r--templates/pages/const.mako38
-rw-r--r--templates/pages/constadd.jinja12
-rw-r--r--templates/pages/constadd.mako16
-rw-r--r--templates/pages/constedit.jinja13
-rw-r--r--templates/pages/constedit.mako10
-rw-r--r--templates/pages/constlist.jinja23
-rw-r--r--templates/pages/constlist.mako32
8 files changed, 87 insertions, 96 deletions
diff --git a/templates/pages/const.jinja b/templates/pages/const.jinja
new file mode 100644
index 0000000..13e8008
--- /dev/null
+++ b/templates/pages/const.jinja
@@ -0,0 +1,39 @@
+{% extends "page.jinja" %}
+
+{% set fmt="%m.%Y" %}
+
+{% block heading %}
+ Konstante Kosten
+{% endblock %}
+
+{% block content %}
+ <ul class="arrow">
+ <li><span class="heading">Beschreibung:</span> {{exp.description}}</li>
+ <li><span class="heading">Kategorie:</span> {{exp.category.name}}</li>
+ <li><span class="heading">Betrag:</span> {{exp.expense | eur}}</li>
+ <li><span class="heading">Betrag pro Monat:</span> {{exp.monthly | eur}}</li>
+ <li><span class="heading">Start:</span> {{exp.start | date(format=fmt)}}</li>
+ <li><span class="heading">Ende:</span> {{exp.end | date(format=fmt)}}</li>
+ <li><span class="heading">Zahlungsrhythmus:</span>
+ {% if exp.months == 1 %}
+ monatlich
+ {% elif exp.months == 6 %}
+ halbjährlich
+ {% elif exp.months == 12 %}
+ jährlich
+ {% else %}
+ alle {{exp.months}} Monate
+ {% endif %}
+ </ul>
+ <p>
+ <a href="{{ url_for(".edit", id = exp.id) }}">Bearbeiten</a>&nbsp;
+ <a href="{{ url_for(".add_from", other = exp.id) }}">Erstelle neuen auf dem jetzigen basierenden Eintrag</a>
+ </p>
+ {% if exp.prev %} {{ left_arrow(url_for(".show", id = exp.prev.id), target(exp.prev)) }} {% endif %}
+ {% if exp.next %} {{ right_arrow(url_for(".show", id = exp.next.id), target(exp.next)) }} {% endif %}
+{% endblock %}
+
+{% macro target(p) -%}
+ {{ p.description }} ({{ p.start | date(fmt) ~ "-" ~ p.end | date(fmt) }})<br>
+ {{ p.expense | eur }}
+{%- endmacro %}
diff --git a/templates/pages/const.mako b/templates/pages/const.mako
deleted file mode 100644
index 95098ea..0000000
--- a/templates/pages/const.mako
+++ /dev/null
@@ -1,38 +0,0 @@
-<%inherit file="/page.mako" />
-
-<ul class="arrow">
- <li><span class="heading">Beschreibung:</span> ${exp.description}</li>
- <li><span class="heading">Kategorie:</span> ${exp.category.name}</li>
- <li><span class="heading">Betrag:</span> ${exp.expense | eur}</li>
- <li><span class="heading">Betrag pro Monat:</span> ${exp.monthly | eur}</li>
- <li><span class="heading">Start:</span> ${dformat(exp.start)}</li>
- <li><span class="heading">Ende:</span> ${dformat(exp.end)}</li>
- <li><span class="heading">Zahlungsrhythmus:</span>
- % if exp.months == 1:
- monatlich
- % elif exp.months == 6:
- halbjährlich
- % elif exp.months == 12:
- jährlich
- % else:
- alle ${exp.months} Monate
- % endif
-</ul>
-<p><a href=${"/const/edit/%s" % exp.id | url}>Bearbeiten</a> <a href=${"/const/add/from/%s" % exp.id | url}>Erstelle neuen auf dem jetzigen basierenden Eintrag</a></p>
-
-<%
- def create(p):
- return ("const/%s" % p.id, "%s (%s-%s)<br>%s" % (p.description, dformat(p.start), dformat(p.end), eur(p.expense)))
-
- p = exp.prev
- if p:
- context.write(self.left_arrow(*create(p)))
-
- p = exp.next
- if p:
- context.write(self.right_arrow(*create(p)))
-%>
-
-<%block name="heading">
- Konstante Kosten
-</%block>
diff --git a/templates/pages/constadd.jinja b/templates/pages/constadd.jinja
new file mode 100644
index 0000000..8f878b4
--- /dev/null
+++ b/templates/pages/constadd.jinja
@@ -0,0 +1,12 @@
+{% extends "page.jinja" %}
+
+{% block heading %}
+ Füge neue konstante Ausgabe hinzu
+{% endblock %}
+
+{% block content %}
+ <form name="add_const_expense" method="post" action="{{ url_for(".add") }}">
+ {{ render_form(form) }}
+ <input type="submit" name="changeB">
+ </form>
+{% endblock %}
diff --git a/templates/pages/constadd.mako b/templates/pages/constadd.mako
deleted file mode 100644
index 2c16544..0000000
--- a/templates/pages/constadd.mako
+++ /dev/null
@@ -1,16 +0,0 @@
-<%inherit file="/page.mako" />
-
-% if not form.valid:
- FEHLER!
-% endif
-
-<form name="add_const_expense" method="post">
- ${form.render()}
- <%block name="form_buttons">
- <input type="submit" name="changeB"/>
- </%block>
-</form>
-
-<%block name="heading">
- Füge neue konstante Ausgabe hinzu
-</%block>
diff --git a/templates/pages/constedit.jinja b/templates/pages/constedit.jinja
new file mode 100644
index 0000000..c440ecb
--- /dev/null
+++ b/templates/pages/constedit.jinja
@@ -0,0 +1,13 @@
+{% extends "page.jinja" %}
+
+{% block heading %}
+ Konstante Ausgabe bearbeiten
+{% endblock %}
+
+{% block content %}
+ <form name="edit_const_expense" method="post">
+ {{ render_form(form) }}
+ <input type="submit" name="changeB">
+ <input type="submit" name="deleteB" value="Eintrag löschen" />
+ </form>
+{% endblock %}
diff --git a/templates/pages/constedit.mako b/templates/pages/constedit.mako
deleted file mode 100644
index 7507bf9..0000000
--- a/templates/pages/constedit.mako
+++ /dev/null
@@ -1,10 +0,0 @@
-<%inherit file="constadd.mako" />
-
-<%block name="heading">
- Konstante Ausgabe bearbeiten
-</%block>
-
-<%block name="form_buttons">
- <input type="submit" name="changeB" />
- <input type="submit" name="deleteB" value="Eintrag löschen" />
-</%block>
diff --git a/templates/pages/constlist.jinja b/templates/pages/constlist.jinja
new file mode 100644
index 0000000..ffe121f
--- /dev/null
+++ b/templates/pages/constlist.jinja
@@ -0,0 +1,23 @@
+{% extends "page.jinja" %}
+
+{% block heading %}
+ Konstante Kosten
+{% endblock %}
+
+{% block content %}
+ <p><a href="{{ url_for(".add") }}">Neuen Eintrag hinzufügen</a></p>
+
+ {{ list(current, "Aktuell") }}
+
+ {% if future %} {{ list(future, "Zukünftige") }} {% endif %}
+ {% if old %} {{ list(old, "Veraltet") }} {% endif %}
+{% endblock %}
+
+{% macro list(list, h) %}
+ <h2>{{ h }}</h2>
+ <ul class="arrow">
+ {% for c in list -%}
+ <li><a href="{{ url_for(".show", id = c.id) }}">{{c.description}} ({{c.expense | eur}})</a></li>
+ {% endfor %}
+ </ul>
+{% endmacro %}
diff --git a/templates/pages/constlist.mako b/templates/pages/constlist.mako
deleted file mode 100644
index f870b80..0000000
--- a/templates/pages/constlist.mako
+++ /dev/null
@@ -1,32 +0,0 @@
-<%inherit file="/page.mako" />
-
-<p><a href=${"/const/add" | url}>Neuen Eintrag hinzufügen</a></p>
-
-<h2>Aktuell</h2>
-<ul class="arrow">
- % for c in current:
- <li><a href=${"/const/%s" % c.id | url}>${c.description} (${c.expense | eur})</a></li>
- % endfor
-</ul>
-
-% if future:
- <h2>Zukünftige</h2>
- <ul class="arrow">
- % for c in future:
- <li><a href=${"/const/%s" % c.id | url}>${c.description} (${c.expense | eur})</a></li>
- % endfor
- </ul>
-% endif
-
-% if old:
- <h2>Veraltet</h2>
- <ul class="arrow">
- % for c in old:
- <li><a href=${"/const/%s" % c.id | url}>${c.description} (${c.expense | eur})</a></li>
- % endfor
- </ul>
-% endif
-
-<%block name="heading">
- Konstante Kosten
-</%block>