diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-08-31 15:12:58 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-08-31 15:12:58 +0000 |
commit | daa8eaa9aebcc284e2904d1258cbfdd78ea23876 (patch) | |
tree | bf0238ae2199c787134a9f3bfdee2468c8832b82 /app/controllers/files_controller.rb | |
parent | a188abbe2813372d426afd2ab05841f0503f00c1 (diff) | |
download | redmine-daa8eaa9aebcc284e2904d1258cbfdd78ea23876.tar.gz redmine-daa8eaa9aebcc284e2904d1258cbfdd78ea23876.zip |
Refactor: move method, ProjectsController#list_files to FilesController#index.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4051 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/files_controller.rb')
-rw-r--r-- | app/controllers/files_controller.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb new file mode 100644 index 000000000..c84ce5f51 --- /dev/null +++ b/app/controllers/files_controller.rb @@ -0,0 +1,22 @@ +class FilesController < ApplicationController + menu_item :files + + before_filter :find_project + before_filter :authorize + + helper :sort + include SortHelper + + def index + sort_init 'filename', 'asc' + sort_update 'filename' => "#{Attachment.table_name}.filename", + 'created_on' => "#{Attachment.table_name}.created_on", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" + + @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)] + @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse + render :layout => !request.xhr? + end + +end |