annotate .svn/pristine/cf/cf1f7ec64f7ca44a3fcc2b553d180407341c51aa.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
rev   line source
Chris@1295 1 <h3><%=l(:label_spent_time)%> (<%= l(:label_last_n_days, 7) %>)</h3>
Chris@1295 2 <%
Chris@1295 3 entries = TimeEntry.find(:all,
Chris@1295 4 :conditions => ["#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", @user.id, Date.today - 6, Date.today],
Chris@1295 5 :include => [:activity, :project, {:issue => [:tracker, :status]}],
Chris@1295 6 :order => "#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC")
Chris@1295 7 entries_by_day = entries.group_by(&:spent_on)
Chris@1295 8 %>
Chris@1295 9
Chris@1295 10 <div class="total-hours">
Chris@1295 11 <p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p>
Chris@1295 12 </div>
Chris@1295 13
Chris@1295 14 <% if entries.any? %>
Chris@1295 15 <table class="list time-entries">
Chris@1295 16 <thead><tr>
Chris@1295 17 <th><%= l(:label_activity) %></th>
Chris@1295 18 <th><%= l(:label_project) %></th>
Chris@1295 19 <th><%= l(:field_comments) %></th>
Chris@1295 20 <th><%= l(:field_hours) %></th>
Chris@1295 21 <th></th>
Chris@1295 22 </tr></thead>
Chris@1295 23 <tbody>
Chris@1295 24 <% entries_by_day.keys.sort.reverse.each do |day| %>
Chris@1295 25 <tr class="odd">
Chris@1295 26 <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
Chris@1295 27 <td colspan="2"></td>
Chris@1295 28 <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
Chris@1295 29 <td></td>
Chris@1295 30 </tr>
Chris@1295 31 <% entries_by_day[day].each do |entry| -%>
Chris@1295 32 <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;">
Chris@1295 33 <td class="activity"><%=h entry.activity %></td>
Chris@1295 34 <td class="subject"><%=h entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
Chris@1295 35 <td class="comments"><%=h entry.comments %></td>
Chris@1295 36 <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
Chris@1295 37 <td align="center">
Chris@1295 38 <% if entry.editable_by?(@user) -%>
Chris@1295 39 <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
Chris@1295 40 :title => l(:button_edit) %>
Chris@1295 41 <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry},
Chris@1295 42 :data => {:confirm => l(:text_are_you_sure)},
Chris@1295 43 :method => :delete,
Chris@1295 44 :title => l(:button_delete) %>
Chris@1295 45 <% end -%>
Chris@1295 46 </td>
Chris@1295 47 </tr>
Chris@1295 48 <% end -%>
Chris@1295 49 <% end -%>
Chris@1295 50 </tbody>
Chris@1295 51 </table>
Chris@1295 52 <% end %>