From d3f6ca543338c5773394033a1ce72b5902352392 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 5 Aug 2009 15:49:05 -0700 Subject: [PATCH] [#2271] Refactored the inline HTML generation to a helper and render call. --- app/views/issues/_show_overhead.html.erb | 19 +++++++++++++++++++ lib/overhead_issue_hook.rb | 17 ++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 app/views/issues/_show_overhead.html.erb diff --git a/app/views/issues/_show_overhead.html.erb b/app/views/issues/_show_overhead.html.erb new file mode 100644 index 0000000..997af03 --- /dev/null +++ b/app/views/issues/_show_overhead.html.erb @@ -0,0 +1,19 @@ + + + + <%= l(:overhead_billable_time) -%>: + + + + <%= l_hours(issue.billable_time_spent) %> + + + + + <%= l(:overhead_overhead_time) -%>: + + + + <%= l_hours(issue.overhead_time_spent) %> + + diff --git a/lib/overhead_issue_hook.rb b/lib/overhead_issue_hook.rb index 4cd242a..235c168 100644 --- a/lib/overhead_issue_hook.rb +++ b/lib/overhead_issue_hook.rb @@ -1,19 +1,10 @@ class OverheadIssueHook < Redmine::Hook::ViewListener def view_issues_show_details_bottom(context={}) if context[:project].module_enabled?('budget_module') - billable_label = content_tag(:td, - content_tag(:strong, l(:overhead_billable_time)+":"), - :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 + overhead_label + overhead_spent, - :class => 'overhead-plugin') + return context[:controller].send(:render_to_string, { + :partial => 'issues/show_overhead', + :locals => {:issue => context[:issue]} + }) else return '' end