Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using div.splitpanel against th-td on issues show bottom details view hook when rendering plugin related fileds - redmine 3 compatibility #1131

Open
wants to merge 1 commit into
base: feature/redmine3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions app/views/hooks/_view_issues_show_details_bottom.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<%=
begin
if Backlogs.configured?(issue.project)
issue_fields_rows do |rows|
if issue.is_story?
rows.left l(:field_story_points), RbStory.find(issue.id).points_display, :class => 'story-points'

unless issue.remaining_hours.nil?
rows.left l(:field_remaining_hours), l_hours(issue.remaining_hours), :class => 'remaining-hours'
end

rows.left l(:field_velocity_based_estimate), issue.velocity_based_estimate ? issue.velocity_based_estimate.to_s + ' days' : '', :class => 'velocity-based-estimate'

unless issue.release_id.nil?
release = RbRelease.find(issue.release_id)
link_to_release = link_to(release.name, url_for_prefix_in_hooks + url_for({:controller => 'rb_releases', :action => 'show', :release_id => release}))
relation_translate = l("label_release_relationship_#{RbStory.find(issue.id).release_relationship}")
rows.right l(:field_release), link_to_release, :class => 'release'
rows.right l(:field_release_relationship), relation_translate, :class => 'release-relationship'
end
end

if issue.is_task? && User.current.allowed_to?(:update_remaining_hours, project) != nil
rows.left l(:field_remaining_hours), issue.remaining_hours, :class => 'remaining-hours'
end
end
end
rescue => e
controller.send(:flash)[:error] = "Backlogs error: #{e.message} (#{e.class})"
Rails.logger.error "#{e.message} (#{e.class}): " + e.backtrace.join("\n")
''
end
%>
37 changes: 1 addition & 36 deletions lib/backlogs_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,43 +80,8 @@ def view_issues_sidebar_planning_bottom(context={ })
end
end

def view_issues_show_details_bottom(context={ })
begin
issue = context[:issue]

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

snippet = ''
render_on :view_issues_show_details_bottom, :partial => 'hooks/view_issues_show_details_bottom'

project = context[:project]

if issue.is_story?
snippet += "<tr><th>#{l(:field_story_points)}</th><td>#{RbStory.find(issue.id).points_display}</td>"
unless issue.remaining_hours.nil?
snippet += "<th>#{l(:field_remaining_hours)}</th><td>#{l_hours(issue.remaining_hours)}</td>"
end
snippet += "</tr>"
vbe = issue.velocity_based_estimate
snippet += "<tr><th>#{l(:field_velocity_based_estimate)}</th><td>#{vbe ? vbe.to_s + ' days' : '-'}</td></tr>"

unless issue.release_id.nil?
release = RbRelease.find(issue.release_id)
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>"
relation_translate = l("label_release_relationship_#{RbStory.find(issue.id).release_relationship}")
snippet += "<th>#{l(:field_release_relationship)}</th><td>#{relation_translate}</td></tr>"
end
end

if issue.is_task? && User.current.allowed_to?(:update_remaining_hours, project) != nil
snippet += "<tr><th>#{l(:field_remaining_hours)}</th><td>#{issue.remaining_hours}</td></tr>"
end

return snippet
rescue => e
exception(context, e)
return ''
end
end

def view_issues_form_details_bottom(context={ })
begin
Expand Down