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"]
|
@ori_query = @default_widget["query"]
|
||||||
result = nil
|
result = nil
|
||||||
result_objects = nil
|
result_objects = nil
|
||||||
|
result = eval(@ori_query)
|
||||||
if !params["tag_id"].blank?
|
if !params["tag_id"].blank?
|
||||||
if params["category_id"].blank? #has tag no cate
|
if params["category_id"].blank? #has tag no cate
|
||||||
result = eval(@ori_query)
|
|
||||||
result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
||||||
else #has tag and cate
|
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[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
|
||||||
result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
||||||
end
|
end
|
||||||
elsif params["category_id"].blank? #no tag no cate
|
elsif params["category_id"].blank? #no tag no cate
|
||||||
result = eval(@ori_query)
|
|
||||||
else #no tag has cate
|
else #no tag has cate
|
||||||
result = eval(@ori_query)
|
|
||||||
result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
|
result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
|
||||||
end
|
end
|
||||||
|
|
||||||
eval("result.#{@default_widget[:sorting_query]}")
|
eval("result.#{@default_widget[:sorting_query]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Announcement
|
||||||
widgets do
|
widgets do
|
||||||
default_widget do
|
default_widget do
|
||||||
sorting 'desc(:postdate)'
|
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"]
|
enable ["typeA","typeB_style3","typeC"]
|
||||||
image :image
|
image :image
|
||||||
field :postdate
|
field :postdate
|
||||||
|
|
Loading…
Reference in New Issue