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)
42 42
    when 'Date'
43 43
      format_date(value)
44 44
    when 'Fixnum', 'Float'
45
      if column.name == :done_ratio
46
        progress_bar(value, :width => '80px')
45
      case column.name
46
      when :done_ratio
47
          progress_bar(value, :width => '80px')
48
      when :estimated_hours
49
          l_hours(value)
47 50
      else
48 51
        value.to_s
49 52
      end
app/views/my/blocks/_timelog.rhtml (revision 19692)
8 8
%>
9 9

  
10 10
<div class="total-hours">
11
<p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p>
11
<p><%= l(:label_total) %>: <%= l_hours(entries.sum(&:hours)) %></p>
12 12
</div>
13 13

  
14 14
<% if entries.any? %>
......
25 25
    <tr class="odd">
26 26
    <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
27 27
    <td colspan="2"></td>
28
    <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
28
    <td class="hours"><em><%= l_hours(entries_by_day[day].sum(&:hours)) %></em></td>
29 29
    <td></td>
30 30
    </tr>
31 31
    <% entries_by_day[day].each do |entry| -%>
......
33 33
    <td class="activity"><%=h entry.activity %></td>
34 34
    <td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
35 35
    <td class="comments"><%=h entry.comments %></td>
36
    <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
36
    <td class="hours"><%= l_hours(entry.hours) %></td>
37 37
    <td align="center">
38 38
    <% if entry.editable_by?(@user) -%>
39 39
        <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
app/views/timelog/_list.rhtml (revision 19692)
24 24
<% end -%>
25 25
</td>
26 26
<td class="comments"><%=h entry.comments %></td>
27
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
27
<td class="hours"><%= l_hours(entry.hours) %></td>
28 28
<td align="center">
29 29
<% if entry.editable_by?(User.current) -%>
30 30
    <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry, :project_id => nil},
lib/redmine/i18n.rb (revision 19692)
1 1
module Redmine
2
  module I18n
2
  module I18n        
3 3
    def self.included(base)
4 4
      base.extend Redmine::I18n
5 5
    end
......
28 28
    
29 29
    def l_hours(hours)
30 30
      hours = hours.to_f
31
      l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
31
      hours_part = hours.truncate
32
      minutes_part = ((hours - hours_part) * 60).round
33
      "#{hours_part}h #{minutes_part}m"
32 34
    end
33 35
    
34 36
    def ll(lang, str, value=nil)
    (1-1/1)