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