summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--controller.py12
-rw-r--r--templates/pages/show.mako22
2 files changed, 20 insertions, 14 deletions
diff --git a/controller.py b/controller.py
index 417046d..e194d22 100644
--- a/controller.py
+++ b/controller.py
@@ -14,7 +14,8 @@ from sqlalchemy import sql
class Show:
def GET(self, year = '', month = ''):
if year:
- return self.render([self.calc(year, month)])
+ c = self.calc(year, month)
+ return self.render([c], self.is_last(c))
else:
d = datetime.date.today()
@@ -24,7 +25,7 @@ class Show:
else:
second = self.calc(d.year, d.month - 1)
- return self.render([first, second])
+ return self.render([first, second], self.is_last(first))
def calc(self, year, month):
@@ -41,8 +42,11 @@ class Show:
return MonthExpense(datetime.date(int(year), int(month), 1), exps)
- def render(self, exps):
- return render("show", exps = exps)
+ def is_last(self, exp):
+ return exp.date >= datetime.date.today().replace(day = 1)
+
+ def render(self, exps, is_last):
+ return render("show", exps = exps, is_last = is_last)
class Add:
diff --git a/templates/pages/show.mako b/templates/pages/show.mako
index cf14638..aa67768 100644
--- a/templates/pages/show.mako
+++ b/templates/pages/show.mako
@@ -31,16 +31,18 @@
<span class="navdate">${date}</span>
</a>
-<%
- 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))
-%>
-<a id="right" href=${"/" + date | url}>
- <span class="navdate">${date}</span>
- <img src=${"/static/images/arrow_right.png" | url}/>
-</a>
+% 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))
+ %>
+ <a id="right" href=${"/" + date | url}>
+ <span class="navdate">${date}</span>
+ <img src=${"/static/images/arrow_right.png" | url}/>
+ </a>
+% endif
<%def name="heading()">
% if len(exps) > 1: