diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 578bdc5e8..2796c6a5c 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -32,7 +32,7 @@ class PagesController < ApplicationController if params[:clicked_field_name] render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page else - render_page unless save_from_no_lang_for_page + render_page(params) unless save_from_no_lang_for_page end when 'Link' redirect_to(@item[:url]) unless save_from_no_lang_for_page diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index a4b1b53d9..0ffb4f0f3 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -19,8 +19,12 @@ module ParserFrontEnd end def parse_page_content(page,args=nil) - tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id] - category = params[:category_id].blank? ? page[:category] : params[:category_id] + try{ + args["category_id"] = args["category_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if args["category_id"].is_a? String + args["tag_id"] = args["tag_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if args["category_id"].is_a? String + } + # tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id] + # category = params[:category_id].blank? ? page[:category] : params[:category_id] body = Nokogiri::HTML(page.content) body.css('orbit_front').each do |front| if front['value'] @@ -29,9 +33,12 @@ module ParserFrontEnd ret = '' part = PagePart.find(front['part_id']) if front['part_id'] ret << eval("\"#{front['path']}\"") rescue '' - args.each do |index,arg| - ret << (ret.include?("?") ? "&#{index}=#{arg}": "?#{index}=#{arg}" ) + if index=="tag_id" || index=="category_id" + ret << (ret.include?("?") ? "&#{index}[]=#{arg}": "?#{index}[]=#{arg}" ) + else + ret << (ret.include?("?") ? "&#{index}=#{arg}": "?#{index}=#{arg}" ) + end end if args fragment = Nokogiri::HTML::DocumentFragment.new(body, "
") end