|
4 | 4 | module BacklogsPlugin
|
5 | 5 | module Hooks
|
6 | 6 | class LayoutHook < Redmine::Hook::ViewListener
|
| 7 | + |
| 8 | + include IssuesHelper |
7 | 9 | # this ought to be view_issues_sidebar_queries_bottom, but
|
8 | 10 | # the entire queries toolbar is disabled if you don't have
|
9 | 11 | # custom queries
|
@@ -86,35 +88,34 @@ def view_issues_show_details_bottom(context={ })
|
86 | 88 |
|
87 | 89 | return '' unless Backlogs.configured?(issue.project)
|
88 | 90 |
|
89 |
| - snippet = '' |
90 |
| - |
91 | 91 | project = context[:project]
|
92 | 92 |
|
93 |
| - if issue.is_story? |
94 |
| - snippet += "<tr><th>#{l(:field_story_points)}</th><td>#{RbStory.find(issue.id).points_display}</td>" |
95 |
| - unless issue.remaining_hours.nil? |
96 |
| - snippet += "<th>#{l(:field_remaining_hours)}</th><td>#{l_hours(issue.remaining_hours)}</td>" |
| 93 | + issue_fields_rows do |rows| |
| 94 | + |
| 95 | + if issue.is_story? |
| 96 | + rows.left l(:field_story_points), RbStory.find(issue.id).points_display, :class => 'story-points' |
| 97 | + unless issue.remaining_hours.nil? |
| 98 | + rows.right l(:field_remaining_hours), l_hours(issue.remaining_hours), :class => 'remaining-hours' |
| 99 | + end |
| 100 | + |
| 101 | + vbe = issue.velocity_based_estimate |
| 102 | + rows.left l(:field_velocity_based_estimate), vbe ? vbe.to_s + ' days' : '-', :class => 'velocity-based-estimate' |
| 103 | + |
| 104 | + unless issue.release_id.nil? |
| 105 | + release = RbRelease.find(issue.release_id) |
| 106 | + rows.left l(:field_release), link_to(release.name, url_for_prefix_in_hooks + url_for({:controller => 'rb_releases', :action => 'show', :release_id => release})), :class => 'release' |
| 107 | + relation_translate = l("label_release_relationship_#{RbStory.find(issue.id).release_relationship}") |
| 108 | + rows.right l(:field_release_relationship), relation_translate, :class => 'release-relationship' |
| 109 | + end |
97 | 110 | end
|
98 |
| - snippet += "</tr>" |
99 |
| - vbe = issue.velocity_based_estimate |
100 |
| - snippet += "<tr><th>#{l(:field_velocity_based_estimate)}</th><td>#{vbe ? vbe.to_s + ' days' : '-'}</td></tr>" |
101 |
| - |
102 |
| - unless issue.release_id.nil? |
103 |
| - release = RbRelease.find(issue.release_id) |
104 |
| - snippet += "<tr><th>#{l(:field_release)}</th><td>#{link_to(release.name, url_for_prefix_in_hooks + url_for({:controller => 'rb_releases', :action => 'show', :release_id => release}))}</td>" |
105 |
| - relation_translate = l("label_release_relationship_#{RbStory.find(issue.id).release_relationship}") |
106 |
| - snippet += "<th>#{l(:field_release_relationship)}</th><td>#{relation_translate}</td></tr>" |
| 111 | + |
| 112 | + if issue.is_task? && User.current.allowed_to?(:update_remaining_hours, project) != nil |
| 113 | + rows.left l(:field_remaining_hours), issue.remaining_hours, :class => 'remaining-hours' |
107 | 114 | end
|
108 |
| - end |
109 | 115 |
|
110 |
| - if issue.is_task? && User.current.allowed_to?(:update_remaining_hours, project) != nil |
111 |
| - snippet += "<tr><th>#{l(:field_remaining_hours)}</th><td>#{issue.remaining_hours}</td></tr>" |
112 | 116 | end
|
113 |
| - |
114 |
| - return snippet |
115 | 117 | rescue => e
|
116 | 118 | exception(context, e)
|
117 |
| - return '' |
118 | 119 | end
|
119 | 120 | end
|
120 | 121 |
|
@@ -154,7 +155,6 @@ def view_issues_form_details_bottom(context={ })
|
154 | 155 |
|
155 | 156 | if issue.descendants.length != 0 && !issue.new_record?
|
156 | 157 | snippet += <<-generatedscript
|
157 |
| -
|
158 | 158 | <script type="text/javascript">
|
159 | 159 | var $j = RB.$ || $;
|
160 | 160 | $j(function($) {
|
@@ -279,7 +279,6 @@ def view_versions_show_bottom(context={ })
|
279 | 279 | # this wouldn't be necesary if the schedules plugin
|
280 | 280 | # didn't disable the contextual hook
|
281 | 281 | snippet += <<-generatedscript
|
282 |
| -
|
283 | 282 | <script type="text/javascript">
|
284 | 283 | var $j = RB.$ || $;
|
285 | 284 | $j(function($) {
|
|
0 commit comments