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