fix announcement language
This commit is contained in:
parent
45136f915d
commit
134b639465
|
@ -12,24 +12,20 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
|
|
||||||
def query_for_default_widget
|
def query_for_default_widget
|
||||||
@ori_class_name = @default_widget["query"].split('.')[0]
|
@ori_class_name = @default_widget["query"].split('.')[0]
|
||||||
@ori_query = @default_widget["query"]
|
@result = eval(@default_widget["query"])
|
||||||
result = 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.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.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
|
||||||
|
|
||||||
else #no tag has cate
|
else #no tag has cate
|
||||||
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
|
||||||
|
|
||||||
def search_result
|
def search_result
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Announcement
|
||||||
widgets do
|
widgets do
|
||||||
default_widget do
|
default_widget do
|
||||||
sorting 'desc(:postdate)'
|
sorting 'desc(:postdate)'
|
||||||
query 'Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
|
query 'Bulletin.available_for_lang(I18n.locale).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