|
|
@ -61,8 +61,7 @@ class AdminController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
#管理员界面课程资源列表
|
|
|
|
#管理员界面课程资源列表
|
|
|
|
def course_resource_list
|
|
|
|
def course_resource_list
|
|
|
|
#sort_init 'created_on','desc'
|
|
|
|
|
|
|
|
#sort_update %w(filename filesize filetype created_on downloads author course)
|
|
|
|
|
|
|
|
if params[:sort] == 'file_size'
|
|
|
|
if params[:sort] == 'file_size'
|
|
|
|
@resource = Attachment.where(:container_type => 'Course').order("filesize desc")
|
|
|
|
@resource = Attachment.where(:container_type => 'Course').order("filesize desc")
|
|
|
|
elsif params[:sort] == 'file_upload'
|
|
|
|
elsif params[:sort] == 'file_upload'
|
|
|
@ -73,8 +72,6 @@ class AdminController < ApplicationController
|
|
|
|
@resource = Attachment.where(:container_type => 'Course').order("created_on desc")
|
|
|
|
@resource = Attachment.where(:container_type => 'Course').order("created_on desc")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@resource = paginateHelper @resource,30
|
|
|
|
@resource = paginateHelper @resource,30
|
|
|
|
@page = (params['page'] || 1).to_i - 1
|
|
|
|
@page = (params['page'] || 1).to_i - 1
|
|
|
|
|
|
|
|
|
|
|
@ -85,7 +82,17 @@ class AdminController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
#管理员界面項目资源列表
|
|
|
|
#管理员界面項目资源列表
|
|
|
|
def project_resource_list
|
|
|
|
def project_resource_list
|
|
|
|
@pro_resource = Attachment.where(:container_type => 'Project')
|
|
|
|
|
|
|
|
|
|
|
|
if params[:sort] == 'file_size'
|
|
|
|
|
|
|
|
@pro_resource = Attachment.where(:container_type => 'Project').order("filesize desc")
|
|
|
|
|
|
|
|
elsif params[:sort] == 'file_upload'
|
|
|
|
|
|
|
|
@pro_resource = Attachment.where(:container_type => 'Project').order("created_on desc")
|
|
|
|
|
|
|
|
elsif params[:sort] == 'file_download_times'
|
|
|
|
|
|
|
|
@pro_resource = Attachment.where(:container_type => 'Project').order("downloads desc")
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@pro_resource = Attachment.where(:container_type => 'Project').order("created_on desc")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
@pro_resource = paginateHelper @pro_resource,30
|
|
|
|
@pro_resource = paginateHelper @pro_resource,30
|
|
|
|
@page = (params['page'] || 1).to_i - 1
|
|
|
|
@page = (params['page'] || 1).to_i - 1
|
|
|
|
|
|
|
|
|
|
|
|