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