Change in announcement init for query

Change in default widget query
This commit is contained in:
chris 2013-03-27 16:31:42 +08:00 committed by Matt K. Fu
parent 74f9dea6b9
commit 5b2f653b5a
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class DefaultWidgetController< OrbitWidgetController
result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])") result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])")
end end
date_now = Time.now 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 end
def default_widget def default_widget

View File

@ -24,7 +24,7 @@ module Announcement
widgets do widgets do
default_widget do default_widget do
enable ["typeA","typeC"] 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 image :image
field :postdate field :postdate
link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self} link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self}