From 8a19b90efae210820ebedadf7ae5eb13067b1f2e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 22 Aug 2016 17:25:10 -0500 Subject: [PATCH] Add hook to customize timesheet shift rendering Also decrease font size slightly for shift text. --- tailbone/static/css/timesheet.css | 3 ++- tailbone/templates/shifts/base.mako | 2 +- tailbone/views/shifts/lib.py | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tailbone/static/css/timesheet.css b/tailbone/static/css/timesheet.css index 3ce4ed9f..b5d79137 100644 --- a/tailbone/static/css/timesheet.css +++ b/tailbone/static/css/timesheet.css @@ -75,7 +75,8 @@ .timesheet tbody p.shift { display: block; - margin: 0; + font-size: 0.9em; + margin: 2px; } .timesheet tbody tr.total { diff --git a/tailbone/templates/shifts/base.mako b/tailbone/templates/shifts/base.mako index d2f019c0..c5427547 100644 --- a/tailbone/templates/shifts/base.mako +++ b/tailbone/templates/shifts/base.mako @@ -143,7 +143,7 @@ % for day in emp.weekdays: % for shift in day['shifts']: -

${shift.get_display(request.rattail_config)}

+

${render_shift(shift)}

% endfor % endfor diff --git a/tailbone/views/shifts/lib.py b/tailbone/views/shifts/lib.py index e346177a..3cb8b0ef 100644 --- a/tailbone/views/shifts/lib.py +++ b/tailbone/views/shifts/lib.py @@ -273,8 +273,12 @@ class TimeSheetView(View): 'next_sunday': sunday + datetime.timedelta(days=7), 'weekdays': weekdays, '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): """ 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), 'weekdays': weekdays, 'permission_prefix': self.key, + 'render_shift': self.render_shift, } def modify_employees(self, employees, weekdays):