mirror of
https://github.com/redmine/redmine.git
synced 2026-03-06 04:21:23 +01:00
All ancestors must be active to unarchive a project.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/work@2155 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -165,6 +165,7 @@ class Project < ActiveRecord::Base
|
||||
self.status == STATUS_ACTIVE
|
||||
end
|
||||
|
||||
# Archives the project and its descendants recursively
|
||||
def archive
|
||||
# Archive subprojects if any
|
||||
children.each do |subproject|
|
||||
@@ -173,11 +174,14 @@ class Project < ActiveRecord::Base
|
||||
update_attribute :status, STATUS_ARCHIVED
|
||||
end
|
||||
|
||||
# Unarchives the project
|
||||
# All its ancestors must be active
|
||||
def unarchive
|
||||
return false if parent && !parent.active?
|
||||
return false if ancestors.detect {|a| !a.active?}
|
||||
update_attribute :status, STATUS_ACTIVE
|
||||
end
|
||||
|
||||
# Returns an array of projects the project can be moved to
|
||||
def possible_parents
|
||||
@possible_parents ||= (Project.active.find(:all) - self_and_descendants)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user