No sort order in specific document view

Added by . . about 12 years ago

Hello Redmine family:)

Can You describe me how to set sort order (by date, name etc.)
in specific document view.
This function is avalible in Document category view, marked in the my screenshot.

Give me please some advise:-)

Best Regards,
Lucas

SpecDocView.jpg (73.7 KB)

DocView.jpg (83 KB)

Replies (3)

RE: No sort order in specific document view - Added by . . about 12 years ago

Hey,
Are there some plugins with are supporting such functionality?
Please help me with this issue.

Lucas

RE: No sort order in specific document view - Added by Zee Prime about 11 years ago

Index: documents_controller.rb
===================================================================
--- documents_controller.rb     
+++ documents_controller.rb     (working copy)
@@ -27,7 +27,7 @@

   def index
     @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
-    documents = @project.documents.find :all, :include => [:attachments, :category]
+    documents = @project.documents.find :all, :include => [:attachments, :category], :order => 'title ASC'
     case @sort_by
     when 'date'
       @grouped = documents.group_by {|d| d.updated_on.to_date }
@@ -43,7 +43,7 @@
   end

   def show
-    @attachments = @document.attachments.find(:all, :order => "created_on DESC")
+    @attachments = @document.attachments.find(:all, :order => "filename ASC")
   end

RE: No sort order in specific document view - Added by nok mac over 9 years ago

app/views/attachments/_links.html.erb - line#2

<% for attachment in attachments.sort{|a,b|a.filename<=>b.filename} %>

(1-3/3)