From 91c32bce7e26683d02854f84a2b35d8461e16699 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Mon, 10 May 2010 19:57:43 +0200 Subject: Show details --- model.py | 4 ++++ static/js/show.js | 7 +++++++ templates/root.mako | 5 +++++ templates/show.mako | 14 ++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 static/js/show.js diff --git a/model.py b/model.py index ea20a28..fe863b9 100644 --- a/model.py +++ b/model.py @@ -92,6 +92,10 @@ class MonthExpense (namedtuple('MonthExpense', 'date const catexps')): def sum (self): return self.const + sum(x.expense for x in self.catexps) + @property + def all (self): + return SingleExpense.of_month(self.date.month, self.date.year).order_by(SingleExpense.day).all() + def __str__ (self): return '' % (self.date, self.sum) diff --git a/static/js/show.js b/static/js/show.js new file mode 100644 index 0000000..c0b6d12 --- /dev/null +++ b/static/js/show.js @@ -0,0 +1,7 @@ +$(document).ready(function(){ + $(".details_heading").click(function() { + $(this).next().toggle() + }) + + $(".details").hide() +}) diff --git a/templates/root.mako b/templates/root.mako index 627d14a..25fd2a4 100644 --- a/templates/root.mako +++ b/templates/root.mako @@ -2,6 +2,7 @@ + ${self.js()} ${self.title()} ${self.style()} @@ -45,6 +46,10 @@ +<%def name="js()"> + + + <%def name="footer()"> powered by mako & web.py | © 2010. All Rights Reserved. René Neumann | diff --git a/templates/show.mako b/templates/show.mako index 270477a..97c2731 100644 --- a/templates/show.mako +++ b/templates/show.mako @@ -9,6 +9,15 @@ % endfor Constant: ${e.const}
In Summa: ${e.sum}

+ +

Details

+
+
    + % for exp in e.all: +
  • ${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense}
  • + % endfor +
+
% endfor <%def name="heading()"> @@ -23,3 +32,8 @@ <%def name="get_d(e)"> ${e.date.year}/${e.date.month} + +<%def name="js()"> + ${parent.js()} + + -- cgit v1.2.3-70-g09d2