Add prev/next week navigation to time sheet view

This commit is contained in:
Lance Edgar 2016-05-02 19:26:21 -05:00
parent 25ec005764
commit 34482892f7
2 changed files with 7 additions and 0 deletions

View file

@ -14,6 +14,9 @@
position: absolute; position: absolute;
right: 0; right: 0;
} }
.timesheet-header .week-picker label {
margin-left: 1em;
}
.timesheet { .timesheet {
border-bottom: 1px solid black; border-bottom: 1px solid black;
border-right: 1px solid black; border-right: 1px solid black;
@ -77,6 +80,8 @@
<div class="week-picker"> <div class="week-picker">
${h.form(url('timesheet'))} ${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')}
<label>Jump to week:</label> <label>Jump to week:</label>
${h.text('date', value=sunday.strftime('%Y-%m-%d'))} ${h.text('date', value=sunday.strftime('%Y-%m-%d'))}
${h.submit('go', "Go")} ${h.submit('go', "Go")}

View file

@ -106,6 +106,8 @@ class TimeSheetView(View):
'employee': employee, 'employee': employee,
'week_of': week_of, 'week_of': week_of,
'sunday': sunday, 'sunday': sunday,
'prev_sunday': sunday - datetime.timedelta(days=7),
'next_sunday': sunday + datetime.timedelta(days=7),
'weekdays': weekdays, 'weekdays': weekdays,
'shifts': shifts, 'shifts': shifts,
} }