From b6e71119964e24793fa01e933705d6550fe0023b Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 5 Aug 2009 15:42:08 -0700 Subject: [PATCH] [#2271] Show overhead time on the issue details page. --- lib/overhead_issue_hook.rb | 7 ++++++- spec/lib/overhead_issue_hook_spec.rb | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/overhead_issue_hook.rb b/lib/overhead_issue_hook.rb index 217d1fc..4cd242a 100644 --- a/lib/overhead_issue_hook.rb +++ b/lib/overhead_issue_hook.rb @@ -6,8 +6,13 @@ class OverheadIssueHook < Redmine::Hook::ViewListener :class => 'billable-hours') billable_spent = content_tag(:td, l_hours(context[:issue].billable_time_spent)) + overhead_label = content_tag(:td, + content_tag(:strong, l(:overhead_overhead_time)+":"), + :class => 'overhead-hours') + overhead_spent = content_tag(:td, l_hours(context[:issue].overhead_time_spent)) + return content_tag(:tr, - billable_label + billable_spent, + billable_label + billable_spent + overhead_label + overhead_spent, :class => 'overhead-plugin') else return '' diff --git a/spec/lib/overhead_issue_hook_spec.rb b/spec/lib/overhead_issue_hook_spec.rb index 284d4ec..7e3f233 100644 --- a/spec/lib/overhead_issue_hook_spec.rb +++ b/spec/lib/overhead_issue_hook_spec.rb @@ -32,7 +32,7 @@ describe OverheadIssueHook, "#view_issues_show_details_bottom with the budget di stub_view_to_use_controller_instance @project = mock_model(Project) @project.should_receive(:module_enabled?).at_least(:once).with('budget_module').and_return(true) - @issue = mock_model(Issue, :project => @project, :deliverable => nil, :billable_time_spent => nil) + @issue = mock_model(Issue, :project => @project, :deliverable => nil, :billable_time_spent => nil, :overhead_time_spent => nil) @context = { :project => @project, @@ -52,4 +52,13 @@ describe OverheadIssueHook, "#view_issues_show_details_bottom with the budget di @issue.should_receive(:billable_time_spent).and_return(2.0) call_hook(:view_issues_show_details_bottom, @context).should have_tag('td','2.00 hours') end + + it 'should display a label for the overhead time' do + call_hook(:view_issues_show_details_bottom, @context).should have_tag('td.overhead-hours','Overhead time:') + end + + it 'should display the number of overhead hours' do + @issue.should_receive(:overhead_time_spent).and_return(12.0) + call_hook(:view_issues_show_details_bottom, @context).should have_tag('td','12.00 hours') + end end