fix default setting for partial category selection error,due to API changing.
This commit is contained in:
parent
256c51a970
commit
d3f0a10187
|
@ -20,12 +20,12 @@ class DefaultWidgetController< OrbitWidgetController
|
|||
if params["category_id"].blank? #has tag no cate
|
||||
result = @ori_class_name.constantize.where(:tagged_ids.in => params["tag_id"])
|
||||
else #has tag and cate
|
||||
result = eval("#{@ori_class_name}.where(:#{get_category_field_name(@ori_class_name)}.in=>params['category_id'], :tagged_ids.in => params['tag_id'])")
|
||||
result = eval("#{@ori_class_name}.where(:#{get_category_field_name}.in=>params['category_id'], :tagged_ids.in => params['tag_id'])")
|
||||
end
|
||||
elsif params["category_id"].blank? #no tag no cate
|
||||
result = eval(@default_widget["query"])
|
||||
else #no tag has cate
|
||||
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}.in=>params['category_id'])")
|
||||
end
|
||||
result.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
||||
end
|
||||
|
@ -90,7 +90,7 @@ class DefaultWidgetController< OrbitWidgetController
|
|||
end
|
||||
end
|
||||
|
||||
def get_category_field_name()
|
||||
def get_category_field_name
|
||||
@ori_class_name = @ori_class_name.constantize
|
||||
@ori_class_name.fields.each_key do |key|
|
||||
return key if key.include?('category_id')
|
||||
|
|
Reference in New Issue