diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 305d5cae9..2b44ce34b 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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 diff --git a/app/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb index be39e568b..fdca986c9 100644 --- a/app/views/admin/course_resource_list.html.erb +++ b/app/views/admin/course_resource_list.html.erb @@ -16,10 +16,10 @@ 资源类型 - 上传时间 + <%= link_to "上传时间",admin_course_resource_list_path(:sort => "file_upload") %> - 下载次数 + <%= link_to "下载次数",admin_course_resource_list_path(:sort => "file_download_times") %> 上传者