fix homepage sort

This commit is contained in:
nccu 2015-01-09 16:37:02 +08:00
parent 7ec60e32bc
commit 3c435f0f91
1 changed files with 2 additions and 2 deletions

View File

@ -99,8 +99,8 @@ class NewsController < ApplicationController
def widget def widget
params = OrbitHelper.params params = OrbitHelper.params
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:is_hot=>"desc",:postdate=>"desc"} !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_approved.order_by(sort).filter_by_widget_categories if news.nil? 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 page = Page.where(:module => "news").first rescue nil
ma = ModuleApp.find_by_key("news") rescue nil ma = ModuleApp.find_by_key("news") rescue nil