dev_forum
jasder 5 years ago
parent 891597698c
commit cd3147dc97

@ -16,12 +16,17 @@ class FilesController < ApplicationController
sort = params[:sort] || 0 # 0: 降序1: 升序 sort = params[:sort] || 0 # 0: 降序1: 升序
sort_type = params[:sort_type] || 'created_on' # created_on时间排序 downloads下载次数排序; quotes: 引用次数排序 sort_type = params[:sort_type] || 'created_on' # created_on时间排序 downloads下载次数排序; quotes: 引用次数排序
course_second_category_id = params[:course_second_category_id] || 0 # 0: 为主目录, 其他为次目录id course_second_category_id = params[:course_second_category_id] || 0 # 0: 为主目录, 其他为次目录id
@user = current_user || nil @user = current_user
@attachments = @course.attachments.by_course_second_category_id(course_second_category_id) @attachments = @course.attachments.by_course_second_category_id(course_second_category_id)
.includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members]) .includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members])
.ordered(sort: sort.to_i, sort_type: sort_type.strip) .ordered(sort: sort.to_i, sort_type: sort_type.strip)
get_category(@course, course_second_category_id) get_category(@course, course_second_category_id)
@total_count = @attachments.size
@public_count = @attachments.publiced.size
@private_count = @total_count - @public_count
@attachments = @attachments.by_keywords(params[:search])
@attachments = @attachments =
case @user.course_identity(@course) case @user.course_identity(@course)
when 5 when 5
@ -32,12 +37,6 @@ class FilesController < ApplicationController
@attachments @attachments
end end
@total_count = @attachments.size
@public_count = @attachments.publiced.size
@private_count = @total_count - @public_count
@attachments = @attachments.by_keywords(params[:search])
@attachments = @attachments.page(@page).per(@page_size) @attachments = @attachments.page(@page).per(@page_size)
end end

Loading…
Cancel
Save