Set default widget sort to created_at
Don't use page category when home
This commit is contained in:
parent
ec9c68f039
commit
3e79b787bb
|
@ -16,16 +16,16 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
if !params["tag_id"].blank?
|
if !params["tag_id"].blank?
|
||||||
@tag = Tag.find(params["tag_id"]) rescue nil
|
@tag = Tag.find(params["tag_id"]) rescue nil
|
||||||
if params["category_id"].blank?
|
if params["category_id"].blank?
|
||||||
result = @tag.send(ori_class_name.downcase.pluralize)
|
result = @tag.send(ori_class_name.downcase.pluralize).desc(:created_at)
|
||||||
else
|
else
|
||||||
result = @tag.send(ori_class_name.downcase.pluralize).where(get_category_field_name(ori_class_name) => params['category_id'])
|
result = @tag.send(ori_class_name.downcase.pluralize).where(get_category_field_name(ori_class_name) => params['category_id']).desc(:created_at)
|
||||||
end
|
end
|
||||||
elsif params["category_id"].blank?
|
elsif params["category_id"].blank?
|
||||||
result = eval(@default_widget["query"])
|
result = eval(@default_widget["query"]).desc(:created_at)
|
||||||
else
|
else
|
||||||
result = eval("#{ori_class_name}.where(get_category_field_name(ori_class_name) => params['category_id'])")
|
result = eval("#{ori_class_name}.where(get_category_field_name(ori_class_name) => params['category_id'])").desc(:created_at)
|
||||||
end
|
end
|
||||||
result.available_for_lang(I18n.locale).can_display
|
result.available_for_lang(I18n.locale).can_display.desc(:created_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_widget
|
def default_widget
|
||||||
|
|
|
@ -19,7 +19,7 @@ module ParserFrontEnd
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_page_content(page)
|
def parse_page_content(page)
|
||||||
category = params[:category_id].blank? ? page[:category] : params[:category_id]
|
category = params[:category_id].blank? ? (page[:category] unless page.root?) : params[:category_id]
|
||||||
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
||||||
body = Nokogiri::HTML(page.content)
|
body = Nokogiri::HTML(page.content)
|
||||||
body.css('orbit_front').each do |front|
|
body.css('orbit_front').each do |front|
|
||||||
|
|
Reference in New Issue