##// END OF EJS Templates
Display time spent on the issue and the total time spent like estimated hours (#17550)....
Jean-Philippe Lang -
r13891:31bffaa053fc
parent child
Show More
@@ -114,12 +114,28 module IssuesHelper
114 end
114 end
115
115
116 def issue_estimated_hours_details(issue)
116 def issue_estimated_hours_details(issue)
117 s = issue.estimated_hours.present? ? l_hours(issue.estimated_hours) : ""
117 if issue.total_estimated_hours.present?
118 unless issue.leaf? || issue.total_estimated_hours.nil?
118 if issue.total_estimated_hours == issue.estimated_hours
119 s << " (#{l(:label_total)}: #{l_hours(issue.total_estimated_hours)})"
119 l_hours_short(issue.estimated_hours)
120 else
121 s = issue.estimated_hours.present? ? l_hours_short(issue.estimated_hours) : ""
122 s << " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
123 s.html_safe
124 end
125 end
120 end
126 end
127
128 def issue_spent_hours_details(issue)
129 if issue.total_spent_hours > 0
130 if issue.total_spent_hours == issue.spent_hours
131 link_to(l_hours_short(issue.spent_hours), issue_time_entries_path(issue))
132 else
133 s = issue.spent_hours > 0 ? l_hours_short(issue.spent_hours) : ""
134 s << " (#{l(:label_total)}: #{link_to l_hours_short(issue.total_spent_hours), issue_time_entries_path(issue)})"
121 s.html_safe
135 s.html_safe
122 end
136 end
137 end
138 end
123
139
124 # Returns an array of error messages for bulk edited issues
140 # Returns an array of error messages for bulk edited issues
125 def bulk_edit_error_messages(issues)
141 def bulk_edit_error_messages(issues)
@@ -63,7 +63,9
63 end
63 end
64 end
64 end
65 if User.current.allowed_to?(:view_time_entries, @project)
65 if User.current.allowed_to?(:view_time_entries, @project)
66 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'
66 if @issue.total_spent_hours > 0
67 rows.right l(:label_spent_time), issue_spent_hours_details(@issue), :class => 'spent-time'
68 end
67 end
69 end
68 end %>
70 end %>
69 <%= render_custom_fields_rows(@issue) %>
71 <%= render_custom_fields_rows(@issue) %>
@@ -48,6 +48,10 module Redmine
48 l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
48 l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
49 end
49 end
50
50
51 def l_hours_short(hours)
52 "%.2f h" % hours.to_f
53 end
54
51 def ll(lang, str, value=nil)
55 def ll(lang, str, value=nil)
52 ::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" })
56 ::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" })
53 end
57 end
General Comments 0
You need to be logged in to leave comments. Login now