mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-11 19:53:07 +00:00
Replaces #active_children with nested scopes #descendants.active
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/work@2152 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
89ecc00326
commit
76462d76b5
@ -61,7 +61,7 @@ class ReportsController < ApplicationController
|
||||
render :template => "reports/issue_report_details"
|
||||
when "subproject"
|
||||
@field = "project_id"
|
||||
@rows = @project.active_children
|
||||
@rows = @project.descendants.active
|
||||
@data = issues_by_subproject
|
||||
@report_title = l(:field_subproject)
|
||||
render :template => "reports/issue_report_details"
|
||||
@ -72,7 +72,7 @@ class ReportsController < ApplicationController
|
||||
@categories = @project.issue_categories
|
||||
@assignees = @project.members.collect { |m| m.user }
|
||||
@authors = @project.members.collect { |m| m.user }
|
||||
@subprojects = @project.active_children
|
||||
@subprojects = @project.descendants.active
|
||||
issues_by_tracker
|
||||
issues_by_version
|
||||
issues_by_priority
|
||||
@ -229,8 +229,8 @@ private
|
||||
#{Issue.table_name} i, #{IssueStatus.table_name} s
|
||||
where
|
||||
i.status_id=s.id
|
||||
and i.project_id IN (#{@project.active_children.collect{|p| p.id}.join(',')})
|
||||
group by s.id, s.is_closed, i.project_id") if @project.active_children.any?
|
||||
and i.project_id IN (#{@project.descendants.active.collect{|p| p.id}.join(',')})
|
||||
group by s.id, s.is_closed, i.project_id") if @project.descendants.active.any?
|
||||
@issues_by_subproject ||= []
|
||||
end
|
||||
end
|
||||
|
||||
@ -34,7 +34,7 @@ class SearchController < ApplicationController
|
||||
when 'my_projects'
|
||||
User.current.memberships.collect(&:project)
|
||||
when 'subprojects'
|
||||
@project ? ([ @project ] + @project.active_children) : nil
|
||||
@project ? (@project.self_and_descendants.active) : nil
|
||||
else
|
||||
@project
|
||||
end
|
||||
|
||||
@ -44,7 +44,7 @@ module SearchHelper
|
||||
def project_select_tag
|
||||
options = [[l(:label_project_all), 'all']]
|
||||
options << [l(:label_my_projects), 'my_projects'] unless User.current.memberships.empty?
|
||||
options << [l(:label_and_its_subprojects, @project.name), 'subprojects'] unless @project.nil? || @project.active_children.empty?
|
||||
options << [l(:label_and_its_subprojects, @project.name), 'subprojects'] unless @project.nil? || @project.descendants.active.empty?
|
||||
options << [@project.name, ''] unless @project.nil?
|
||||
select_tag('scope', options_for_select(options, params[:scope].to_s)) if options.size > 1
|
||||
end
|
||||
|
||||
@ -203,10 +203,6 @@ class Project < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def active_children
|
||||
children.select {|child| child.active?}
|
||||
end
|
||||
|
||||
# Returns an array of the trackers used by the project and its sub projects
|
||||
def rolled_up_trackers
|
||||
@rolled_up_trackers ||=
|
||||
|
||||
@ -174,8 +174,8 @@ class Query < ActiveRecord::Base
|
||||
unless @project.versions.empty?
|
||||
@available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.sort.collect{|s| [s.name, s.id.to_s] } }
|
||||
end
|
||||
unless @project.active_children.empty?
|
||||
@available_filters["subproject_id"] = { :type => :list_subprojects, :order => 13, :values => @project.active_children.collect{|s| [s.name, s.id.to_s] } }
|
||||
unless @project.descendants.active.empty?
|
||||
@available_filters["subproject_id"] = { :type => :list_subprojects, :order => 13, :values => @project.descendants.active.collect{|s| [s.name, s.id.to_s] } }
|
||||
end
|
||||
add_custom_fields_filters(@project.all_issue_custom_fields)
|
||||
else
|
||||
@ -257,7 +257,7 @@ class Query < ActiveRecord::Base
|
||||
|
||||
def project_statement
|
||||
project_clauses = []
|
||||
if project && !@project.active_children.empty?
|
||||
if project && !@project.descendants.active.empty?
|
||||
ids = [project.id]
|
||||
if has_filter?("subproject_id")
|
||||
case operator_for("subproject_id")
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
<p><% @activity.event_types.each do |t| %>
|
||||
<label><%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %> <%= l("label_#{t.singularize}_plural")%></label><br />
|
||||
<% end %></p>
|
||||
<% if @project && @project.active_children.any? %>
|
||||
<% if @project && @project.descendants.active.any? %>
|
||||
<p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
|
||||
<%= hidden_field_tag 'with_subprojects', 0 %>
|
||||
<% end %>
|
||||
|
||||
@ -60,7 +60,7 @@ class ProjectTest < Test::Unit::TestCase
|
||||
assert !user.projects.include?(@ecookbook)
|
||||
# Subproject are also archived
|
||||
assert !@ecookbook.children.empty?
|
||||
assert @ecookbook.active_children.empty?
|
||||
assert @ecookbook.descendants.active.empty?
|
||||
end
|
||||
|
||||
def test_unarchive
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user