Skip to content

Commit 31b47c6

Browse files
authored
Merge pull request #2 from UweHeber/bug/archiveIssue
Bug/archive issue
2 parents d5927ff + fb209d4 commit 31b47c6

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/project_tree/patches/projects_controller_patch.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ def self.included(base) # :nodoc:
99
base.class_eval do
1010
unloadable
1111
#the before_filter is who gives the authorization to execute the function
12-
before_filter :authorize, :except => [ :index, :children, :autocomplete, :list, :new, :create, :copy ]
12+
before_filter :authorize, :except => [ :index, :children, :autocomplete, :list, :new, :create, :copy, :archive, :unarchive, :destroy ]
13+
1314
end
1415
end
1516

@@ -24,13 +25,16 @@ def children
2425
# encapsulates all children of current project
2526
children = []
2627

27-
project.children.each do |child|
28-
entry = {}
29-
entry[:id] = child.id
30-
entry[:name] = child.name
31-
entry[:identifier] = child.identifier
32-
entry[:has_children] = (child.children.length > 0) ? true : false
33-
children << entry
28+
project.children.each do |child|
29+
# return only active projects to the result
30+
if child.status == 1
31+
entry = {}
32+
entry[:id] = child.id
33+
entry[:name] = child.name
34+
entry[:identifier] = child.identifier
35+
entry[:has_children] = (child.children.length > 0) ? true : false
36+
children << entry
37+
end
3438
end
3539
# add children to the result
3640
result[:children] = children

0 commit comments

Comments
 (0)