Sort archive by top and creation date
This commit is contained in:
parent
91afd49f75
commit
031cf927d5
|
@ -22,20 +22,20 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
|
|||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
||||
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@archive_files = @tag.archive_files.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = @archive_files.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = @tag.archive_files.can_display.desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = @archive_files.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
|
||||
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||
|
||||
elsif !params[:category_id].blank?
|
||||
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
||||
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@archive_files = @tag.archive_files.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = @tag.archive_files.can_display.desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
else
|
||||
@archive_files = ArchiveFile.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = ArchiveFile.can_display.desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
|
|
@ -28,14 +28,14 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
|
|||
date_now = Time.now
|
||||
|
||||
if !params[:category_id].blank?
|
||||
@archive_files = ArchiveFile.all.can_display.any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = ArchiveFile.all.can_display.any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
||||
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
|
||||
get_categorys
|
||||
else
|
||||
@archive_files = ArchiveFile.all.can_display.merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@archive_files = ArchiveFile.all.can_display.merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
get_categorys
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue