附件按时间排序 龙军
This commit is contained in:
parent
5c2a037a8f
commit
b06d462b53
|
@ -26,14 +26,15 @@ class FilesController < ApplicationController
|
|||
include SortHelper
|
||||
|
||||
def index
|
||||
sort_init 'filename', 'asc'
|
||||
sort_update 'filename' => "#{Attachment.table_name}.filename",
|
||||
'created_on' => "#{Attachment.table_name}.created_on",
|
||||
#sort_init 'filename', 'asc'
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
'filename' => "#{Attachment.table_name}.filename",
|
||||
'size' => "#{Attachment.table_name}.filesize",
|
||||
'downloads' => "#{Attachment.table_name}.downloads"
|
||||
|
||||
@containers = [ Project.includes(:attachments).reorder(sort_clause).find(@project.id)]
|
||||
@containers += @project.versions.includes(:attachments).reorder(sort_clause).all.sort.reverse
|
||||
@containers = [ Project.includes(:attachments).reorder("attachments.created_on DESC").find(@project.id)] #modify by Long Jun
|
||||
@containers += @project.versions.includes(:attachments).reorder("created_on DESC").all.sort
|
||||
|
||||
if @project.project_type == 1
|
||||
render :layout => 'base_courses'
|
||||
|
|
Loading…
Reference in New Issue