@@ -1,52 +1,58 | |||||
1 | <h3> |
|
1 | <h3> | |
2 | <%= link_to l(:label_spent_time), time_entries_path(:user_id => 'me') %> |
|
2 | <%= link_to l(:label_spent_time), time_entries_path(:user_id => 'me') %> | |
3 | (<%= l(:label_last_n_days, 7) %>) |
|
3 | (<%= l(:label_last_n_days, 7) %>) | |
4 | </h3> |
|
4 | </h3> | |
5 | <% |
|
5 | <% | |
6 | entries = timelog_items |
|
6 | entries = timelog_items | |
7 | entries_by_day = entries.group_by(&:spent_on) |
|
7 | entries_by_day = entries.group_by(&:spent_on) | |
8 | %> |
|
8 | %> | |
9 |
|
9 | |||
|
10 | <% if User.current.allowed_to?(:log_time, nil, :global => true) %> | |||
|
11 | <div class="contextual"> | |||
|
12 | <%= link_to l(:button_log_time), new_time_entry_path, :class => "icon icon-add" %> | |||
|
13 | </div> | |||
|
14 | <% end %> | |||
|
15 | ||||
10 | <div class="total-hours"> |
|
16 | <div class="total-hours"> | |
11 | <p><%= l(:label_total_time) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p> |
|
17 | <p><%= l(:label_total_time) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p> | |
12 | </div> |
|
18 | </div> | |
13 |
|
19 | |||
14 | <% if entries.any? %> |
|
20 | <% if entries.any? %> | |
15 | <table class="list time-entries"> |
|
21 | <table class="list time-entries"> | |
16 | <thead><tr> |
|
22 | <thead><tr> | |
17 | <th><%= l(:label_activity) %></th> |
|
23 | <th><%= l(:label_activity) %></th> | |
18 | <th><%= l(:label_project) %></th> |
|
24 | <th><%= l(:label_project) %></th> | |
19 | <th><%= l(:field_comments) %></th> |
|
25 | <th><%= l(:field_comments) %></th> | |
20 | <th><%= l(:field_hours) %></th> |
|
26 | <th><%= l(:field_hours) %></th> | |
21 | <th></th> |
|
27 | <th></th> | |
22 | </tr></thead> |
|
28 | </tr></thead> | |
23 | <tbody> |
|
29 | <tbody> | |
24 | <% entries_by_day.keys.sort.reverse.each do |day| %> |
|
30 | <% entries_by_day.keys.sort.reverse.each do |day| %> | |
25 | <tr class="odd"> |
|
31 | <tr class="odd"> | |
26 | <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td> |
|
32 | <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td> | |
27 | <td colspan="2"></td> |
|
33 | <td colspan="2"></td> | |
28 | <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td> |
|
34 | <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td> | |
29 | <td></td> |
|
35 | <td></td> | |
30 | </tr> |
|
36 | </tr> | |
31 | <% entries_by_day[day].each do |entry| -%> |
|
37 | <% entries_by_day[day].each do |entry| -%> | |
32 | <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;"> |
|
38 | <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;"> | |
33 | <td class="activity"><%=h entry.activity %></td> |
|
39 | <td class="activity"><%=h entry.activity %></td> | |
34 | <td class="subject"><%=h entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td> |
|
40 | <td class="subject"><%=h entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td> | |
35 | <td class="comments"><%=h entry.comments %></td> |
|
41 | <td class="comments"><%=h entry.comments %></td> | |
36 | <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td> |
|
42 | <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td> | |
37 | <td class="buttons"> |
|
43 | <td class="buttons"> | |
38 | <% if entry.editable_by?(@user) -%> |
|
44 | <% if entry.editable_by?(@user) -%> | |
39 | <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry}, |
|
45 | <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry}, | |
40 | :title => l(:button_edit) %> |
|
46 | :title => l(:button_edit) %> | |
41 | <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry}, |
|
47 | <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry}, | |
42 | :data => {:confirm => l(:text_are_you_sure)}, |
|
48 | :data => {:confirm => l(:text_are_you_sure)}, | |
43 | :method => :delete, |
|
49 | :method => :delete, | |
44 | :title => l(:button_delete) %> |
|
50 | :title => l(:button_delete) %> | |
45 | <% end -%> |
|
51 | <% end -%> | |
46 | </td> |
|
52 | </td> | |
47 | </tr> |
|
53 | </tr> | |
48 | <% end -%> |
|
54 | <% end -%> | |
49 | <% end -%> |
|
55 | <% end -%> | |
50 | </tbody> |
|
56 | </tbody> | |
51 | </table> |
|
57 | </table> | |
52 | <% end %> |
|
58 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now