From 031cf927d5f12290984a219953de738470bb05a1 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 20 Mar 2013 17:22:40 +0800 Subject: [PATCH] Sort archive by top and creation date --- .../archive/front_end/archive_files_controller.rb | 10 +++++----- .../panel/archive/widget/archive_files_controller.rb | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb index 2e37a970..1b4a9202 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb @@ -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 diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/widget/archive_files_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/widget/archive_files_controller.rb index e9dc6362..3779e1e7 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/widget/archive_files_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/widget/archive_files_controller.rb @@ -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