@@ -0,0 +1,52 | |||
|
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> | |
|
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 | </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, :title => h("#{entry.issue.subject} (#{entry.issue.status})")) 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 => :post, | |
|
44 | :title => l(:button_delete) %> | |
|
45 | <% end -%> | |
|
46 | </td> | |
|
47 | </tr> | |
|
48 | <% end -%> | |
|
49 | <% end -%> | |
|
50 | </tbdoy> | |
|
51 | </table> | |
|
52 | <% end %> |
@@ -26,7 +26,8 class MyController < ApplicationController | |||
|
26 | 26 | 'issueswatched' => :label_watched_issues, |
|
27 | 27 | 'news' => :label_news_latest, |
|
28 | 28 | 'calendar' => :label_calendar, |
|
29 | 'documents' => :label_document_plural | |
|
29 | 'documents' => :label_document_plural, | |
|
30 | 'timelog' => :label_spent_time | |
|
30 | 31 | }.freeze |
|
31 | 32 | |
|
32 | 33 | DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'], |
@@ -216,6 +216,8 class TimelogController < ApplicationController | |||
|
216 | 216 | render_403 and return unless @time_entry.editable_by?(User.current) |
|
217 | 217 | @time_entry.destroy |
|
218 | 218 | flash[:notice] = l(:notice_successful_delete) |
|
219 | redirect_to :back | |
|
220 | rescue RedirectBackError | |
|
219 | 221 | redirect_to :action => 'details', :project_id => @time_entry.project |
|
220 | 222 | end |
|
221 | 223 |
@@ -37,8 +37,8 module ApplicationHelper | |||
|
37 | 37 | user ? link_to(user, :controller => 'account', :action => 'show', :id => user) : 'Anonymous' |
|
38 | 38 | end |
|
39 | 39 | |
|
40 | def link_to_issue(issue) | |
|
41 | link_to "#{issue.tracker.name} ##{issue.id}", :controller => "issues", :action => "show", :id => issue | |
|
40 | def link_to_issue(issue, options={}) | |
|
41 | link_to "#{issue.tracker.name} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, options | |
|
42 | 42 | end |
|
43 | 43 | |
|
44 | 44 | def toggle_link(name, id, options={}) |
@@ -113,9 +113,9 tr.user.locked, tr.user.registered { color: #aaa; } | |||
|
113 | 113 | tr.user.locked a, tr.user.registered a { color: #aaa; } |
|
114 | 114 | |
|
115 | 115 | tr.time-entry { text-align: center; white-space: nowrap; } |
|
116 | tr.time-entry td.subject, tr.time-entry td.comments { text-align: left; } | |
|
117 |
|
|
|
118 |
t |
|
|
116 | tr.time-entry td.subject, tr.time-entry td.comments { text-align: left; white-space: normal; } | |
|
117 | td.hours { text-align: right; font-weight: bold; padding-right: 0.5em; } | |
|
118 | td.hours .hours-dec { font-size: 0.9em; } | |
|
119 | 119 | |
|
120 | 120 | table.list tbody tr:hover { background-color:#ffffdd; } |
|
121 | 121 | table td {padding:2px;} |
General Comments 0
You need to be logged in to leave comments.
Login now