23 lines
744 B
Ruby
23 lines
744 B
Ruby
|
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
|