From ee592286658f9b3234063641e38bbdc7974abc76 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 7 Feb 2013 18:57:54 +0800 Subject: [PATCH] Fix error in parser for category --- lib/parsers/parser_common.rb | 2 +- lib/parsers/parser_front_end.rb | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index b245f576..7d858686 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -258,7 +258,7 @@ module ParserCommon raise ModuleAppError,"PagePart can't find ModuleApp" if part.module_app.nil? "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" end - options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&item_type=page_part" + options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category] : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&item_type=page_part" ret << "
" when 'public_r_tag' ret << "" diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 6db77b62..56d352bb 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -19,7 +19,7 @@ module ParserFrontEnd end def parse_page_content(page) - category = params[:category_id].blank? ? (page[:category] unless page.root?) : params[:category_id] + category = params[:category_id].blank? ? page[:category] : params[:category_id] tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id] body = Nokogiri::HTML(page.content) body.css('orbit_front').each do |front| @@ -137,9 +137,7 @@ module ParserFrontEnd else "/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true" end - - options = "&part_id=\#{part.id}&category_id=\#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}&item_type=page_part" - + options = "&part_id=\#{part.id}&category_id=\#{!part[:category].blank? ? part[:category] : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}&item_type=page_part" ret << "" when 'public_r_tag'