Make the project files list sortable (#997).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1330 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-04-06 10:53:18 +00:00
parent 154f60edd3
commit fe74ab8c06
2 changed files with 8 additions and 5 deletions

View File

@ -204,7 +204,10 @@ class ProjectsController < ApplicationController
end
def list_files
@versions = @project.versions.sort.reverse
sort_init "#{Attachment.table_name}.filename", "asc"
sort_update
@versions = @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
render :layout => !request.xhr?
end
# Show changelog for @project

View File

@ -9,10 +9,10 @@
<table class="list">
<thead><tr>
<th><%=l(:field_version)%></th>
<th><%=l(:field_filename)%></th>
<th><%=l(:label_date)%></th>
<th><%=l(:field_filesize)%></th>
<th><%=l(:label_downloads_abbr)%></th>
<%= sort_header_tag("#{Attachment.table_name}.filename", :caption => l(:field_filename)) %>
<%= sort_header_tag("#{Attachment.table_name}.created_on", :caption => l(:label_date), :default_order => 'desc') %>
<%= sort_header_tag("#{Attachment.table_name}.filesize", :caption => l(:field_filesize), :default_order => 'desc') %>
<%= sort_header_tag("#{Attachment.table_name}.downloads", :caption => l(:label_downloads_abbr), :default_order => 'desc') %>
<th>MD5</th>
<% if delete_allowed %><th></th><% end %>
</tr></thead>