You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_timelog.rhtml 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. <div class="total-hours">
  10. <p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p>
  11. </div>
  12. <% if entries.any? %>
  13. <table class="list time-entries">
  14. <thead>
  15. <th><%= l(:label_activity) %></th>
  16. <th><%= l(:label_project) %></th>
  17. <th><%= l(:field_comments) %></th>
  18. <th><%= l(:field_hours) %></th>
  19. <th></th>
  20. </thead>
  21. <tbody>
  22. <% entries_by_day.keys.sort.reverse.each do |day| %>
  23. <tr class="odd">
  24. <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
  25. <td colspan="2"></td>
  26. <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
  27. <td></td>
  28. </tr>
  29. <% entries_by_day[day].each do |entry| -%>
  30. <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;">
  31. <td class="activity"><%=h entry.activity %></td>
  32. <td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
  33. <td class="comments"><%=h entry.comments %></td>
  34. <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
  35. <td align="center">
  36. <% if entry.editable_by?(@user) -%>
  37. <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
  38. :title => l(:button_edit) %>
  39. <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry},
  40. :confirm => l(:text_are_you_sure),
  41. :method => :post,
  42. :title => l(:button_delete) %>
  43. <% end -%>
  44. </td>
  45. </tr>
  46. <% end -%>
  47. <% end -%>
  48. </tbody>
  49. </table>
  50. <% end %>