From 7e67416b5b1155644190b0681f7252744c3dc8c8 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 22 Apr 2009 09:32:11 -0700 Subject: [PATCH] [#2280] Added a Billable header to the Timesheet plugin's report tables. --- config/locales/en.yml | 1 + init.rb | 2 ++ lib/overhead_timesheet_hook.rb | 6 ++++++ spec/lib/overhead_timesheet_hook_spec.rb | 7 +++++++ 4 files changed, 16 insertions(+) create mode 100644 lib/overhead_timesheet_hook.rb create mode 100644 spec/lib/overhead_timesheet_hook_spec.rb diff --git a/config/locales/en.yml b/config/locales/en.yml index d6ad08b..38a22ee 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,3 +2,4 @@ en: overhead_field_billing_status: Billing Status overhead_field_billable_value: Billable Value overhead_field_overhead_value: Overhead Value + overhead_field_billable: Billable diff --git a/init.rb b/init.rb index 8940541..2d2a84d 100644 --- a/init.rb +++ b/init.rb @@ -9,6 +9,8 @@ Dispatcher.to_prepare do TimeEntryActivity.send(:include, OverheadTimeEntryActivityPatch) end +require 'overhead_timesheet_hook' + Redmine::Plugin.register :redmine_overhead do name 'Overhead plugin' author 'Eric Davis' diff --git a/lib/overhead_timesheet_hook.rb b/lib/overhead_timesheet_hook.rb new file mode 100644 index 0000000..22f5e67 --- /dev/null +++ b/lib/overhead_timesheet_hook.rb @@ -0,0 +1,6 @@ +class OverheadTimesheetHook < Redmine::Hook::ViewListener + + def plugin_timesheet_views_timesheet_group_header(context={}) + return content_tag(:th, l(:overhead_field_billable)) + end +end diff --git a/spec/lib/overhead_timesheet_hook_spec.rb b/spec/lib/overhead_timesheet_hook_spec.rb new file mode 100644 index 0000000..39b097a --- /dev/null +++ b/spec/lib/overhead_timesheet_hook_spec.rb @@ -0,0 +1,7 @@ +require File.dirname(__FILE__) + '/../spec_helper' + +describe OverheadTimesheetHook, "#plugin_timesheet_views_timesheet_group_header" do + it 'should add a Billable column to the table' do + OverheadTimesheetHook.instance.plugin_timesheet_views_timesheet_group_header.should eql('Billable') + end +end