Project

General

Profile

Patch #5007 ยป time_entries_displayed_human_readable_v1.0.patch

Vladimir Kovacik, 2010-03-08 13:37

View differences:

app/helpers/queries_helper.rb (revision 19692)
when 'Date'
format_date(value)
when 'Fixnum', 'Float'
if column.name == :done_ratio
progress_bar(value, :width => '80px')
case column.name
when :done_ratio
progress_bar(value, :width => '80px')
when :estimated_hours
l_hours(value)
else
value.to_s
end
app/views/my/blocks/_timelog.rhtml (revision 19692)
%>
<div class="total-hours">
<p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p>
<p><%= l(:label_total) %>: <%= l_hours(entries.sum(&:hours)) %></p>
</div>
<% if entries.any? %>
......
<tr class="odd">
<td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
<td colspan="2"></td>
<td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
<td class="hours"><em><%= l_hours(entries_by_day[day].sum(&:hours)) %></em></td>
<td></td>
</tr>
<% entries_by_day[day].each do |entry| -%>
......
<td class="activity"><%=h entry.activity %></td>
<td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
<td class="comments"><%=h entry.comments %></td>
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
<td class="hours"><%= l_hours(entry.hours) %></td>
<td align="center">
<% if entry.editable_by?(@user) -%>
<%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
app/views/timelog/_list.rhtml (revision 19692)
<% end -%>
</td>
<td class="comments"><%=h entry.comments %></td>
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
<td class="hours"><%= l_hours(entry.hours) %></td>
<td align="center">
<% if entry.editable_by?(User.current) -%>
<%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry, :project_id => nil},
lib/redmine/i18n.rb (revision 19692)
module Redmine
module I18n
module I18n
def self.included(base)
base.extend Redmine::I18n
end
......
def l_hours(hours)
hours = hours.to_f
l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
hours_part = hours.truncate
minutes_part = ((hours - hours_part) * 60).round
"#{hours_part}h #{minutes_part}m"
end
def ll(lang, str, value=nil)
    (1-1/1)