Skip to content

Commit 96e8f0b

Browse files
danielvijgepixyda-furukawa
authored andcommitted
Fix for Redmine 3.2
Backported from backlogs#1113
1 parent 2fcc757 commit 96e8f0b

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

lib/backlogs_hooks.rb

+22-23
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
module BacklogsPlugin
55
module Hooks
66
class LayoutHook < Redmine::Hook::ViewListener
7+
8+
include IssuesHelper
79
# this ought to be view_issues_sidebar_queries_bottom, but
810
# the entire queries toolbar is disabled if you don't have
911
# custom queries
@@ -86,35 +88,34 @@ def view_issues_show_details_bottom(context={ })
8688

8789
return '' unless Backlogs.configured?(issue.project)
8890

89-
snippet = ''
90-
9191
project = context[:project]
9292

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
97110
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'
107114
end
108-
end
109115

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>"
112116
end
113-
114-
return snippet
115117
rescue => e
116118
exception(context, e)
117-
return ''
118119
end
119120
end
120121

@@ -154,7 +155,6 @@ def view_issues_form_details_bottom(context={ })
154155

155156
if issue.descendants.length != 0 && !issue.new_record?
156157
snippet += <<-generatedscript
157-
158158
<script type="text/javascript">
159159
var $j = RB.$ || $;
160160
$j(function($) {
@@ -279,7 +279,6 @@ def view_versions_show_bottom(context={ })
279279
# this wouldn't be necesary if the schedules plugin
280280
# didn't disable the contextual hook
281281
snippet += <<-generatedscript
282-
283282
<script type="text/javascript">
284283
var $j = RB.$ || $;
285284
$j(function($) {

0 commit comments

Comments
 (0)