* finished Issue 79: When showing the number of files in a folder it should be also counted the sub-folders

git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@147 5e329b0b-a2ee-ea63-e329-299493fc886d
This commit is contained in:
vit.jonas@gmail.com 2011-06-12 09:08:07 +00:00
parent b9e9d68cbc
commit 2d06ddf8fe
2 changed files with 7 additions and 1 deletions

View File

@ -103,6 +103,12 @@ class DmsfFolder < ActiveRecord::Base
return tree
end
def deep_file_count
file_count = self.files.length
self.subfolders.each {|subfolder| file_count += subfolder.deep_file_count}
file_count
end
private
def self.directory_subtree(tree, folder, level, current_folder)

View File

@ -50,7 +50,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<%= link_to(h(subfolder.title),
{:action => "show", :id => @project, :folder_id => subfolder},
:class => "icon icon-folder") %>
<div class="filename" title="<%= l(:title_number_of_files_in_directory)%>">[<%= subfolder.files.count %>]</div>
<div class="filename" title="<%= l(:title_number_of_files_in_directory)%>">[<%= subfolder.deep_file_count %>]</div>
</td>
<td class="size">-</td>
<td class="modified">-</td>