Patch #1116 » show_subproject_versions_in_calendar_and_gantt.patch
| app/controllers/projects_controller.rb (working copy) | ||
|---|---|---|
| 342 | 343 |
: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 | 344 |
) unless @selected_tracker_ids.empty? |
| 344 | 345 |
end |
| 345 |
events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
|
|
| 346 |
events += @project.versions_with_subprojects(@with_subprojects, @calendar.startdt, @calendar.enddt)
|
|
| 346 | 347 |
@calendar.events = events |
| 347 | 348 |
|
| 348 | 349 |
render :layout => false if request.xhr? |
| ... | ... | |
| 387 | 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 | 389 |
) unless @selected_tracker_ids.empty? |
| 389 | 390 |
end |
| 390 |
@events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to])
|
|
| 391 |
@events += @project.versions_with_subprojects(@with_subprojects, @date_from, @date_to)
|
|
| 391 | 392 |
@events.sort! {|x,y| x.start_date <=> y.start_date }
|
| 392 | 393 |
|
| 393 | 394 |
if params[:format]=='pdf' |
| app/models/project.rb (working copy) | ||
|---|---|---|
| 83 | 83 |
yield |
| 84 | 84 |
end |
| 85 | 85 |
end |
| 86 |
|
|
| 87 |
def versions_with_subprojects(include_subprojects=false, startdt=nil, enddt=nil) |
|
| 88 |
conditions = nil |
|
| 89 |
if include_subprojects && !active_children.empty? |
|
| 90 |
ids = [id] + active_children.collect {|c| c.id}
|
|
| 91 |
conditions = ["project_id IN (#{ids.join(',')})"] if not (startdt and enddt)
|
|
| 92 |
conditions ||= ["project_id IN (#{ids.join(',')}) AND effective_date BETWEEN ? AND ?", startdt, enddt]
|
|
| 93 |
else |
|
| 94 |
conditions = ["project_id = #{id}"] if not (startdt and enddt)
|
|
| 95 |
conditions ||= ["project_id = #{id} AND effective_date BETWEEN ? AND ?", startdt, enddt]
|
|
| 96 |
end |
|
| 97 | ||
| 98 |
Version.find :all, :conditions => conditions |
|
| 99 |
end |
|
| 86 | 100 | |
| 87 | 101 |
# returns latest created projects |
| 88 | 102 |
# non public projects will be returned only if user is a member of those |
| app/views/common/_calendar.rhtml (working copy) | ||
|---|---|---|
| 24 | 24 |
<span class="tip"><%= render_issue_tooltip i %></span> |
| 25 | 25 |
</div> |
| 26 | 26 |
<% else %> |
| 27 |
<%= link_to_version i, :class => "icon icon-package" %> |
|
| 27 |
<span class="icon icon-package"> |
|
| 28 |
<%= h("#{i.project.name} -") unless @project && @project == i.project %>
|
|
| 29 |
<%= link_to_version i%> |
|
| 30 |
</span> |
|
| 28 | 31 |
<% end %> |
| 29 | 32 |
<% end %> |
| 30 | 33 |
</td> |
| app/views/projects/gantt.rhtml (working copy) | ||
|---|---|---|
| 73 | 73 |
<%= h("#{i.project.name} -") unless @project && @project == i.project %>
|
| 74 | 74 |
<%= link_to_issue i %>: <%=h i.subject %> |
| 75 | 75 |
<% else %> |
| 76 |
<%= link_to_version i, :class => "icon icon-package" %> |
|
| 76 |
<span class="icon icon-package"> |
|
| 77 |
<%= h("#{i.project.name} -") unless @project && @project == i.project %>
|
|
| 78 |
<%= link_to_version i %> |
|
| 79 |
</span> |
|
| 77 | 80 |
<% end %> |
| 78 | 81 |
</small></div> |
| 79 | 82 |
<% top = top + 20 |
| ... | ... | |
| 197 | 200 |
%> |
| 198 | 201 |
<div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone"> </div> |
| 199 | 202 |
<div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task"> |
| 200 |
<strong><%= i.name %></strong> |
|
| 203 |
<%= h("#{i.project.name} -") unless @project && @project == i.project %>
|
|
| 204 |
<strong><%= i.name %></strong> |
|
| 201 | 205 |
</div> |
| 202 | 206 |
<% end %> |
| 203 | 207 |
<% top = top + 20 |