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?
|
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||||
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
||||||
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
|
@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)
|
||||||
@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 = @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
|
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||||
|
|
||||||
elsif !params[:category_id].blank?
|
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
|
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||||
elsif !params[:tag_id].blank?
|
elsif !params[:tag_id].blank?
|
||||||
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
||||||
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
|
@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
|
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
|
end
|
||||||
|
|
||||||
get_categorys
|
get_categorys
|
||||||
|
|
|
@ -28,14 +28,14 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
|
|
||||||
if !params[:category_id].blank?
|
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)
|
@archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
|
||||||
elsif !params[:tag_id].blank?
|
elsif !params[:tag_id].blank?
|
||||||
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
|
||||||
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
|
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
|
||||||
get_categorys
|
get_categorys
|
||||||
else
|
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
|
get_categorys
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue