完成了课程资源列表的排序(上传时间,资源大小,下载次数)
This commit is contained in:
parent
d3ed89d87e
commit
3fcf192430
|
@ -63,11 +63,18 @@ class AdminController < ApplicationController
|
|||
def course_resource_list
|
||||
#sort_init 'created_on','desc'
|
||||
#sort_update %w(filename filesize filetype created_on downloads author course)
|
||||
if params[:file_size]
|
||||
if params[:sort] == 'file_size'
|
||||
@resource = Attachment.where(:container_type => 'Course').order("filesize desc")
|
||||
elsif params[:sort] == 'file_upload'
|
||||
@resource = Attachment.where(:container_type => 'Course').order("created_on desc")
|
||||
elsif params[:sort] == 'file_download_times'
|
||||
@resource = Attachment.where(:container_type => 'Course').order("downloads desc")
|
||||
else
|
||||
@resource = Attachment.where(:container_type => 'Course').order("created_on desc")
|
||||
end
|
||||
|
||||
|
||||
|
||||
@resource = paginateHelper @resource,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
资源类型
|
||||
</th>
|
||||
<th style="width: 23px;">
|
||||
上传时间
|
||||
<%= link_to "上传时间",admin_course_resource_list_path(:sort => "file_upload") %>
|
||||
</th>
|
||||
<th style="width: 15px;">
|
||||
下载次数
|
||||
<%= link_to "下载次数",admin_course_resource_list_path(:sort => "file_download_times") %>
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
上传者
|
||||
|
|
Loading…
Reference in New Issue