From 3c435f0f91a7d8e7cd12793495015d7865bc55f7 Mon Sep 17 00:00:00 2001 From: nccu Date: Fri, 9 Jan 2015 16:37:02 +0800 Subject: [PATCH] fix homepage sort --- app/controllers/news_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 5d5193f..19b15e3 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -99,8 +99,8 @@ class NewsController < ApplicationController def widget params = OrbitHelper.params - !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:is_hot=>"desc",:postdate=>"desc"} - news = NewsBulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_widget_categories if news.nil? + !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:is_top=>"desc",:postdate=>"desc"} + news = NewsBulletin.where(:title.ne => "",:is_preview.in=>[false,nil],:is_hot => true).is_approved.order_by(sort).filter_by_widget_categories if news.nil? page = Page.where(:module => "news").first rescue nil ma = ModuleApp.find_by_key("news") rescue nil