Patch #14679 » redmine-2.3-stable-roadmap-parent-and-son-issues.patch
| app/models/issue.rb (working copy) | ||
|---|---|---|
| 1030 | 1030 |
end |
| 1031 | 1031 |
end |
| 1032 |
def parents_count |
|
| 1033 |
parent.nil? || parent.project_id != project_id ? 0 : 1 + parent.parents_count |
|
| 1034 |
end |
|
| 1035 | ||
| 1032 | 1036 |
# Returns true if issue's project is a valid |
| 1033 | 1037 |
# parent issue project |
| 1034 | 1038 |
def valid_parent_project?(issue=parent) |
| app/models/version.rb (working copy) | ||
|---|---|---|
| 205 | 205 |
scope :sorted, order(fields_for_order_statement) |
| 206 |
def sorted_fixed_issues |
|
| 207 |
issues = [] |
|
| 208 |
fixed_issues.visible.find(:all, |
|
| 209 |
:conditions => nil, |
|
| 210 |
:include => [:parent, :status, :tracker, :priority], |
|
| 211 |
:order => "#{Tracker.table_name}.position, #{Issue.table_name}.id").each do |issue|
|
|
| 212 |
if issue.parent.nil? || issue.parent.project_id != issue.project_id |
|
| 213 |
issues << issue |
|
| 214 |
issues += find_son_issues({:parent => issue})
|
|
| 215 |
end |
|
| 216 |
end |
|
| 217 |
issues |
|
| 218 |
end |
|
| 219 |
# find all son and grandson issue |
|
| 220 |
def find_son_issues(options) |
|
| 221 |
issues = [] |
|
| 222 |
fixed_issues.visible.find(:all, |
|
| 223 |
:conditions => {:parent_id => options[:parent]},
|
|
| 224 |
:include => [:parent, :status, :tracker, :priority], |
|
| 225 |
:order => "#{Tracker.table_name}.position, #{Issue.table_name}.id").each do |issue|
|
|
| 226 |
issues << issue |
|
| 227 |
issues += find_son_issues(options.merge(:parent => issue)) |
|
| 228 |
end |
|
| 229 |
issues |
|
| 230 |
end |
|
| 231 | ||
| 206 | 232 |
# Returns the sharings that +user+ can set the version to |
| 207 | 233 |
def allowed_sharings(user = User.current) |
| 208 | 234 |
VERSION_SHARINGS.select do |s| |
| app/controllers/versions_controller.rb (working copy) | ||
|---|---|---|
| 62 | 62 |
end |
| 63 | 63 |
def show |
| 64 |
respond_to do |format| |
|
| 65 |
format.html {
|
|
| 66 |
@issues = @version.fixed_issues.visible. |
|
| 67 |
includes(:status, :tracker, :priority). |
|
| 68 |
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
|
|
| 69 |
all |
|
| 70 |
} |
|
| 71 |
format.api |
|
| 72 |
end |
|
| 64 |
@issues = @version.sorted_fixed_issues |
|
| 73 | 65 |
end |
| 74 | 66 |
def new |
| app/views/versions/index.html.erb (working copy) | ||
|---|---|---|
| 13 | 13 |
<%= render :partial => 'versions/overview', :locals => {:version => version} %>
|
| 14 | 14 |
<%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
|
| 15 |
<% if (issues = @issues_by_version[version]) && issues.size > 0 %>
|
|
| 15 |
<% if (issues = version.sorted_fixed_issues) && issues.size > 0 %>
|
|
| 16 | 16 |
<%= form_tag({}) do -%>
|
| 17 | 17 |
<table class="list related-issues"> |
| 18 | 18 |
<caption><%= l(:label_related_issues) %></caption> |
| 19 | 19 |
<% issues.each do |issue| -%> |
| 20 | 20 |
<tr class="hascontextmenu"> |
| 21 | 21 |
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td> |
| 22 |
<td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td> |
|
| 22 |
<td style="padding-left: <%= issue.parents_count %>em"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
|
|
| 23 | 23 |
</tr> |
| 24 | 24 |
<% end -%> |
| 25 | 25 |
</table> |
| app/views/versions/show.html.erb (working copy) | ||
|---|---|---|
| 41 | 41 |
<%- @issues.each do |issue| -%> |
| 42 | 42 |
<tr class="hascontextmenu"> |
| 43 | 43 |
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td> |
| 44 |
<td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td> |
|
| 44 |
<td style="padding-left: <%= issue.parents_count %>em"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
|
|
| 45 | 45 |
</tr> |
| 46 | 46 |
<% end %> |
| 47 | 47 |
</table> |
- « Previous
- 1
- 2
- Next »