To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / views / my / blocks / _timelog.html.erb @ 1298:4f746d8966dd

History | View | Annotate | Download (1.88 KB)

1 0:513646585e45 Chris
<h3><%=l(:label_spent_time)%> (<%= l(:label_last_n_days, 7) %>)</h3>
2 909:cbb26bc654de Chris
<%
3 1295:622f24f53b42 Chris
entries = timelog_items
4 0:513646585e45 Chris
entries_by_day = entries.group_by(&:spent_on)
5
%>
6
7
<div class="total-hours">
8 1295:622f24f53b42 Chris
<p><%= l(:label_total_time) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p>
9 0:513646585e45 Chris
</div>
10
11
<% if entries.any? %>
12
<table class="list time-entries">
13
<thead><tr>
14
<th><%= l(:label_activity) %></th>
15
<th><%= l(:label_project) %></th>
16
<th><%= l(:field_comments) %></th>
17
<th><%= l(:field_hours) %></th>
18
<th></th>
19
</tr></thead>
20
<tbody>
21
<% entries_by_day.keys.sort.reverse.each do |day| %>
22
    <tr class="odd">
23
    <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
24
    <td colspan="2"></td>
25
    <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
26
    <td></td>
27
    </tr>
28
    <% entries_by_day[day].each do |entry| -%>
29
    <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;">
30
    <td class="activity"><%=h entry.activity %></td>
31 1115:433d4f72a19b Chris
    <td class="subject"><%=h entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
32 0:513646585e45 Chris
    <td class="comments"><%=h entry.comments %></td>
33
    <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
34
    <td align="center">
35
    <% if entry.editable_by?(@user) -%>
36
        <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
37
                                           :title => l(:button_edit) %>
38
        <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry},
39 1115:433d4f72a19b Chris
                                             :data => {:confirm => l(:text_are_you_sure)},
40 37:94944d00e43c chris
                                             :method => :delete,
41 0:513646585e45 Chris
                                             :title => l(:button_delete) %>
42
    <% end -%>
43
    </td>
44
    </tr>
45
    <% end -%>
46
<% end -%>
47
</tbody>
48
</table>
49
<% end %>