fix news default widget shows un-checked bulletins.
This commit is contained in:
parent
2c3924d92c
commit
45136f915d
|
@ -15,21 +15,20 @@ class DefaultWidgetController< OrbitWidgetController
|
|||
@ori_query = @default_widget["query"]
|
||||
result = nil
|
||||
result_objects = nil
|
||||
result = eval(@ori_query)
|
||||
if !params["tag_id"].blank?
|
||||
if params["category_id"].blank? #has tag no cate
|
||||
result = eval(@ori_query)
|
||||
result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
||||
else #has tag and cate
|
||||
result = eval(@ori_query)
|
||||
result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
|
||||
result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
||||
end
|
||||
elsif params["category_id"].blank? #no tag no cate
|
||||
result = eval(@ori_query)
|
||||
|
||||
else #no tag has cate
|
||||
result = eval(@ori_query)
|
||||
result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
|
||||
end
|
||||
|
||||
eval("result.#{@default_widget[:sorting_query]}")
|
||||
end
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ module Announcement
|
|||
widgets do
|
||||
default_widget do
|
||||
sorting 'desc(:postdate)'
|
||||
query 'Bulletin.any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
|
||||
query 'Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
|
||||
enable ["typeA","typeB_style3","typeC"]
|
||||
image :image
|
||||
field :postdate
|
||||
|
|
Loading…
Reference in New Issue