Permalink
Browse files

Fixed the module count in the ui to include sub modules (issue 708)

  • Loading branch information...
1 parent ab588c0 commit 931aeb6ee591c94adf9232900a78a6260b39f32b @qswain2 qswain2 committed Sep 3, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 extensions/admin_ui/controllers/modules/modules.rb
@@ -591,12 +591,15 @@ def retitle_recursive_tree(parent)
# append the number of command modules so the branch name results in: "<category name> (num)"
parent.each {|command_module_branch|
if command_module_branch.is_a?(Hash) and command_module_branch.has_key?('children')
- num_of_command_modules = command_module_branch['children'].length
- command_module_branch['text'] = command_module_branch['text'] + " (" + num_of_command_modules.to_s() + ")"
-
+ num_of_subs = 0
command_module_branch['children'].each {|c|
+ #add in the submodules and subtract 1 for the folder node
+ num_of_subs+=c['children'].length-1 if c.has_key?('children')
retitle_recursive_tree([c]) if c.has_key?('cls') and c['cls'] == 'folder'
}
+ num_of_command_modules = command_module_branch['children'].length + num_of_subs
+ command_module_branch['text'] = command_module_branch['text'] + " (" + num_of_command_modules.to_s() + ")"
+
end
}
end

0 comments on commit 931aeb6

Please sign in to comment.