#994 修复项目资源下载排序问题

This commit is contained in:
gonglexin 2014-10-23 15:29:33 +08:00
parent a16cdb5068
commit 0ed9fab16f
2 changed files with 3 additions and 3 deletions

View File

@ -72,7 +72,7 @@ class FilesController < ApplicationController
end end
if order_by.count == 1 if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} desc " sort += "#{Attachment.table_name}.#{attribute} asc "
elsif order_by.count == 2 elsif order_by.count == 2
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
end end
@ -83,7 +83,7 @@ class FilesController < ApplicationController
end end
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder(sort).all.sort @containers += @project.versions.includes(:attachments).reorder(sort).all
show_attachments @containers show_attachments @containers

View File

@ -17,7 +17,7 @@
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure",:class => "tableth") %> <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure",:class => "tableth") %>
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children",:class => "tableth") %> <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children",:class => "tableth") %>
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype",:class => "tableth") %> <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype",:class => "tableth") %>
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype",:class => "tableth") %> <%= content_tag('th', l(:attachment_sufix_browse), id: 'vzebra-contenttype', class: 'tableth', style: 'color: black')%>
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense",:class => "tableth") %> <%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense",:class => "tableth") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action",:class => "tableth") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action",:class => "tableth") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children",:class => "tableth") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children",:class => "tableth") %>