better rendering time for projects/calendar

git-svn-id: http://redmine.rubyforge.org/svn/trunk@343 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-03-18 10:17:59 +00:00
parent 8fdef1f820
commit db3e8616c8
2 changed files with 7 additions and 4 deletions

View File

@ -519,7 +519,12 @@ class ProjectsController < ApplicationController
# finish on sunday # finish on sunday
@date_to = @date_to + (7-@date_to.cwday) @date_to = @date_to + (7-@date_to.cwday)
@issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to]) @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority],
:conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to])
@ending_issues_by_days = @issues.group_by {|issue| issue.due_date}
@starting_issues_by_days = @issues.group_by {|issue| issue.start_date}
render :layout => false if request.xhr? render :layout => false if request.xhr?
end end

View File

@ -43,9 +43,7 @@ while day <= @date_to
<% end %> <% end %>
<td valign="top" class="<%= day.month==@month ? "even" : "odd" %>" style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>"> <td valign="top" class="<%= day.month==@month ? "even" : "odd" %>" style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>">
<p class="textright"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> <p class="textright"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p>
<% day_issues = [] <% ((@ending_issues_by_days[day] || []) + (@starting_issues_by_days[day] || [])).uniq.each do |i| %>
@issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day }
day_issues.each do |i| %>
<div class="tooltip"> <div class="tooltip">
<%= if day == i.start_date and day == i.due_date <%= if day == i.start_date and day == i.due_date
image_tag('arrow_bw.png') image_tag('arrow_bw.png')