From fc151535954629000895de64cea3e7c452fb1c84 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Mon, 5 Jul 2010 23:54:11 +0200 Subject: Only show right nav arrow, if the following month is not in the future --- controller.py | 12 ++++++++---- templates/pages/show.mako | 22 ++++++++++++---------- 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 @@ ${date} -<% - 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)) -%> - - ${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)) + %> + + ${date} + + +% endif <%def name="heading()"> % if len(exps) > 1: -- cgit v1.2.3-54-g00ecf root/templates/user (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-07-052to3 fixed too muchRené 'Necoro' Neumann1-1/+1
2016-07-052to3 conversionRené 'Necoro' Neumann12-42/+42
2016-07-05First batch of py3 changesRené 'Necoro' Neumann7-8/+7
2016-05-01Removed base 'Expense' class; introduce CategoryModel insteadRené 'Necoro' Neumann1-6/+7
2016-05-01Ignore .pyoRené 'Necoro' Neumann1-0/+1