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
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) %>
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