From 34482892f7cd23f6264399bf88933d740c628416 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 2 May 2016 19:26:21 -0500 Subject: [PATCH] Add prev/next week navigation to time sheet view --- tailbone/templates/timesheet/index.mako | 5 +++++ tailbone/views/timesheet.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tailbone/templates/timesheet/index.mako b/tailbone/templates/timesheet/index.mako index 32b26ccf..54943bab 100644 --- a/tailbone/templates/timesheet/index.mako +++ b/tailbone/templates/timesheet/index.mako @@ -14,6 +14,9 @@ position: absolute; right: 0; } + .timesheet-header .week-picker label { + margin-left: 1em; + } .timesheet { border-bottom: 1px solid black; border-right: 1px solid black; @@ -77,6 +80,8 @@
${h.form(url('timesheet'))} + ${h.link_to(u"« Previous", '?date=' + prev_sunday.strftime('%Y-%m-%d'), class_='button')} + ${h.link_to(u"Next »", '?date=' + next_sunday.strftime('%Y-%m-%d'), class_='button')} ${h.text('date', value=sunday.strftime('%Y-%m-%d'))} ${h.submit('go', "Go")} diff --git a/tailbone/views/timesheet.py b/tailbone/views/timesheet.py index 06c426a1..2b96e358 100644 --- a/tailbone/views/timesheet.py +++ b/tailbone/views/timesheet.py @@ -106,6 +106,8 @@ class TimeSheetView(View): 'employee': employee, 'week_of': week_of, 'sunday': sunday, + 'prev_sunday': sunday - datetime.timedelta(days=7), + 'next_sunday': sunday + datetime.timedelta(days=7), 'weekdays': weekdays, 'shifts': shifts, }