##// END OF EJS Templates
Include subprojects versions on calendar and gantt (#1116)....
Jean-Philippe Lang -
r1349:6a3236daea38
parent child
Show More
@@ -341,8 +341,9 class ProjectsController < ApplicationController
341 :include => [:tracker, :status, :assigned_to, :priority, :project],
341 :include => [:tracker, :status, :assigned_to, :priority, :project],
342 :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?)) AND #{Issue.table_name}.tracker_id IN (#{@selected_tracker_ids.join(',')})", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
342 :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?)) AND #{Issue.table_name}.tracker_id IN (#{@selected_tracker_ids.join(',')})", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
343 ) unless @selected_tracker_ids.empty?
343 ) unless @selected_tracker_ids.empty?
344 events += Version.find(:all, :include => :project,
345 :conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
344 end
346 end
345 events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
346 @calendar.events = events
347 @calendar.events = events
347
348
348 render :layout => false if request.xhr?
349 render :layout => false if request.xhr?
@@ -386,8 +387,9 class ProjectsController < ApplicationController
386 :include => [:tracker, :status, :assigned_to, :priority, :project],
387 :include => [:tracker, :status, :assigned_to, :priority, :project],
387 :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]
388 :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]
388 ) unless @selected_tracker_ids.empty?
389 ) unless @selected_tracker_ids.empty?
390 @events += Version.find(:all, :include => :project,
391 :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to])
389 end
392 end
390 @events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to])
391 @events.sort! {|x,y| x.start_date <=> y.start_date }
393 @events.sort! {|x,y| x.start_date <=> y.start_date }
392
394
393 if params[:format]=='pdf'
395 if params[:format]=='pdf'
@@ -75,12 +75,14 class Project < ActiveRecord::Base
75 conditions = nil
75 conditions = nil
76 if include_subprojects && !active_children.empty?
76 if include_subprojects && !active_children.empty?
77 ids = [id] + active_children.collect {|c| c.id}
77 ids = [id] + active_children.collect {|c| c.id}
78 conditions = ["#{Issue.table_name}.project_id IN (#{ids.join(',')})"]
78 conditions = ["#{Project.table_name}.id IN (#{ids.join(',')})"]
79 end
79 end
80 conditions ||= ["#{Issue.table_name}.project_id = ?", id]
80 conditions ||= ["#{Project.table_name}.id = ?", id]
81 # Quick and dirty fix for Rails 2 compatibility
81 # Quick and dirty fix for Rails 2 compatibility
82 Issue.send(:with_scope, :find => { :conditions => conditions }) do
82 Issue.send(:with_scope, :find => { :conditions => conditions }) do
83 yield
83 Version.send(:with_scope, :find => { :conditions => conditions }) do
84 yield
85 end
84 end
86 end
85 end
87 end
86
88
@@ -19,12 +19,15 while day <= calendar.enddt %>
19 elsif day == i.due_date
19 elsif day == i.due_date
20 image_tag('arrow_to.png')
20 image_tag('arrow_to.png')
21 end %>
21 end %>
22 <%= h("#{i.project.name} -") unless @project && @project == i.project %>
22 <%= h("#{i.project} -") unless @project && @project == i.project %>
23 <%= link_to_issue i %>: <%= h(truncate(i.subject, 30)) %>
23 <%= link_to_issue i %>: <%= h(truncate(i.subject, 30)) %>
24 <span class="tip"><%= render_issue_tooltip i %></span>
24 <span class="tip"><%= render_issue_tooltip i %></span>
25 </div>
25 </div>
26 <% else %>
26 <% else %>
27 <%= link_to_version i, :class => "icon icon-package" %>
27 <span class="icon icon-package">
28 <%= h("#{i.project} -") unless @project && @project == i.project %>
29 <%= link_to_version i%>
30 </span>
28 <% end %>
31 <% end %>
29 <% end %>
32 <% end %>
30 </td>
33 </td>
@@ -70,10 +70,13 top = headers_height + 8
70 @events.each do |i| %>
70 @events.each do |i| %>
71 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
71 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
72 <% if i.is_a? Issue %>
72 <% if i.is_a? Issue %>
73 <%= h("#{i.project.name} -") unless @project && @project == i.project %>
73 <%= h("#{i.project} -") unless @project && @project == i.project %>
74 <%= link_to_issue i %>: <%=h i.subject %>
74 <%= link_to_issue i %>: <%=h i.subject %>
75 <% else %>
75 <% else %>
76 <%= link_to_version i, :class => "icon icon-package" %>
76 <span class="icon icon-package">
77 <%= h("#{i.project} -") unless @project && @project == i.project %>
78 <%= link_to_version i %>
79 </span>
77 <% end %>
80 <% end %>
78 </small></div>
81 </small></div>
79 <% top = top + 20
82 <% top = top + 20
@@ -197,7 +200,8 top = headers_height + 10
197 %>
200 %>
198 <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone">&nbsp;</div>
201 <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone">&nbsp;</div>
199 <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
202 <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
200 <strong><%= i.name %></strong>
203 <%= h("#{i.project} -") unless @project && @project == i.project %>
204 <strong><%=h i %></strong>
201 </div>
205 </div>
202 <% end %>
206 <% end %>
203 <% top = top + 20
207 <% top = top + 20
General Comments 0
You need to be logged in to leave comments. Login now