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

Feature/redmine3 2 #1113

Open
wants to merge 2 commits 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
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ group :test do
gem 'cucumber-rails', require: false
gem "culerity"
gem "cucumber"
gem "capybara", "~> 1"
#gem "faye-websocket"
gem "poltergeist"
gem "database_cleaner"
Expand Down
43 changes: 22 additions & 21 deletions lib/backlogs_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
module BacklogsPlugin
module Hooks
class LayoutHook < Redmine::Hook::ViewListener

include IssuesHelper
# this ought to be view_issues_sidebar_queries_bottom, but
# the entire queries toolbar is disabled if you don't have
# custom queries
Expand Down Expand Up @@ -86,35 +88,34 @@ def view_issues_show_details_bottom(context={ })

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

snippet = ''

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>"
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.right l(:field_remaining_hours), l_hours(issue.remaining_hours), :class => 'remaining-hours'
end

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

unless issue.release_id.nil?
release = RbRelease.find(issue.release_id)
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'
relation_translate = l("label_release_relationship_#{RbStory.find(issue.id).release_relationship}")
rows.right l(:field_release_relationship), relation_translate, :class => 'release-relationship'
end
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>"

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

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

Expand Down