1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-04 14:49:41 +00:00

Display time spent on the issue and the total time spent like estimated hours (#17550).

git-svn-id: http://svn.redmine.org/redmine/trunk@14273 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-05-25 12:06:38 +00:00
parent 481f70d125
commit 31bffaa053
3 changed files with 27 additions and 5 deletions

View File

@ -114,11 +114,27 @@ module IssuesHelper
end
def issue_estimated_hours_details(issue)
s = issue.estimated_hours.present? ? l_hours(issue.estimated_hours) : ""
unless issue.leaf? || issue.total_estimated_hours.nil?
s << " (#{l(:label_total)}: #{l_hours(issue.total_estimated_hours)})"
if issue.total_estimated_hours.present?
if issue.total_estimated_hours == issue.estimated_hours
l_hours_short(issue.estimated_hours)
else
s = issue.estimated_hours.present? ? l_hours_short(issue.estimated_hours) : ""
s << " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
s.html_safe
end
end
end
def issue_spent_hours_details(issue)
if issue.total_spent_hours > 0
if issue.total_spent_hours == issue.spent_hours
link_to(l_hours_short(issue.spent_hours), issue_time_entries_path(issue))
else
s = issue.spent_hours > 0 ? l_hours_short(issue.spent_hours) : ""
s << " (#{l(:label_total)}: #{link_to l_hours_short(issue.total_spent_hours), issue_time_entries_path(issue)})"
s.html_safe
end
end
s.html_safe
end
# Returns an array of error messages for bulk edited issues

View File

@ -63,7 +63,9 @@
end
end
if User.current.allowed_to?(:view_time_entries, @project)
rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), issue_time_entries_path(@issue)) : "-"), :class => 'spent-time'
if @issue.total_spent_hours > 0
rows.right l(:label_spent_time), issue_spent_hours_details(@issue), :class => 'spent-time'
end
end
end %>
<%= render_custom_fields_rows(@issue) %>

View File

@ -48,6 +48,10 @@ module Redmine
l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
end
def l_hours_short(hours)
"%.2f h" % hours.to_f
end
def ll(lang, str, value=nil)
::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" })
end