Add hook to customize timesheet shift rendering

Also decrease font size slightly for shift text.
This commit is contained in:
Lance Edgar 2016-08-22 17:25:10 -05:00
parent cdde848275
commit 8a19b90efa
3 changed files with 8 additions and 2 deletions

View file

@ -75,7 +75,8 @@
.timesheet tbody p.shift { .timesheet tbody p.shift {
display: block; display: block;
margin: 0; font-size: 0.9em;
margin: 2px;
} }
.timesheet tbody tr.total { .timesheet tbody tr.total {

View file

@ -143,7 +143,7 @@
% for day in emp.weekdays: % for day in emp.weekdays:
<td> <td>
% for shift in day['shifts']: % for shift in day['shifts']:
<p class="shift">${shift.get_display(request.rattail_config)}</p> <p class="shift">${render_shift(shift)}</p>
% endfor % endfor
</td> </td>
% endfor % endfor

View file

@ -273,8 +273,12 @@ class TimeSheetView(View):
'next_sunday': sunday + datetime.timedelta(days=7), 'next_sunday': sunday + datetime.timedelta(days=7),
'weekdays': weekdays, 'weekdays': weekdays,
'permission_prefix': self.key, 'permission_prefix': self.key,
'render_shift': self.render_shift,
} }
def render_shift(self, shift):
return shift.get_display(self.rattail_config)
def render_single(self, date, employee, form=None): def render_single(self, date, employee, form=None):
""" """
Render a time sheet for one employee, for the week which includes the Render a time sheet for one employee, for the week which includes the
@ -304,6 +308,7 @@ class TimeSheetView(View):
'next_sunday': sunday + datetime.timedelta(days=7), 'next_sunday': sunday + datetime.timedelta(days=7),
'weekdays': weekdays, 'weekdays': weekdays,
'permission_prefix': self.key, 'permission_prefix': self.key,
'render_shift': self.render_shift,
} }
def modify_employees(self, employees, weekdays): def modify_employees(self, employees, weekdays):