]> source.dussan.org Git - redmine.git/commitdiff
Make the project files list sortable (#997).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 6 Apr 2008 10:53:18 +0000 (10:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 6 Apr 2008 10:53:18 +0000 (10:53 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1330 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/projects_controller.rb
app/views/projects/list_files.rhtml

index 199b2f0c52ef3e2dde30fbbd67a7a91aecbbc162..afd7f6569f179dd3f27025582f6f338c7d7b1440 100644 (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
index ec4a3619b2bd70587e493ffba0882c957acf37c6..f385229ae0b6f7ad62f7f876980c5c7fafc1bd04 100644 (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>