From 5b2f653b5a3280a7d7a078981e72d519689f48ee Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 27 Mar 2013 16:31:42 +0800 Subject: [PATCH] Change in announcement init for query Change in default widget query --- app/controllers/default_widget_controller.rb | 2 +- vendor/built_in_modules/announcement/init.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index 7fcab3d2b..c8b4eddd9 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -36,7 +36,7 @@ class DefaultWidgetController< OrbitWidgetController result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])") end date_now = Time.now - result.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, :postdate) + result.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate) end def default_widget diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index 0b9bad5d8..c0178c0b2 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -24,7 +24,7 @@ module Announcement widgets do default_widget do enable ["typeA","typeC"] - query 'Bulletin.all' + query 'Bulletin.any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )' image :image field :postdate link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self}