From 3fcf19243063da52788cd098bd8046faca8916fd Mon Sep 17 00:00:00 2001 From: linchun Date: Tue, 15 Mar 2016 15:59:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8=E7=9A=84=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=EF=BC=88=E4=B8=8A=E4=BC=A0=E6=97=B6=E9=97=B4=EF=BC=8C=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=A4=A7=E5=B0=8F=EF=BC=8C=E4=B8=8B=E8=BD=BD=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 9 ++++++++- app/views/admin/course_resource_list.html.erb | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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") %> 上传者