[#2271] Refactored the inline HTML generation to a helper and render call.
This commit is contained in:
19
app/views/issues/_show_overhead.html.erb
Normal file
19
app/views/issues/_show_overhead.html.erb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<tr class="overhead-plugin">
|
||||||
|
<td class="billable-hours">
|
||||||
|
<strong>
|
||||||
|
<%= l(:overhead_billable_time) -%>:
|
||||||
|
</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= l_hours(issue.billable_time_spent) %>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="overhead-hours">
|
||||||
|
<strong>
|
||||||
|
<%= l(:overhead_overhead_time) -%>:
|
||||||
|
</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= l_hours(issue.overhead_time_spent) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
@@ -1,19 +1,10 @@
|
|||||||
class OverheadIssueHook < Redmine::Hook::ViewListener
|
class OverheadIssueHook < Redmine::Hook::ViewListener
|
||||||
def view_issues_show_details_bottom(context={})
|
def view_issues_show_details_bottom(context={})
|
||||||
if context[:project].module_enabled?('budget_module')
|
if context[:project].module_enabled?('budget_module')
|
||||||
billable_label = content_tag(:td,
|
return context[:controller].send(:render_to_string, {
|
||||||
content_tag(:strong, l(:overhead_billable_time)+":"),
|
:partial => 'issues/show_overhead',
|
||||||
:class => 'billable-hours')
|
:locals => {:issue => context[:issue]}
|
||||||
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')
|
|
||||||
else
|
else
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user