fix for passing args. code in complete,fronted controller need to take care params,too. backend parser need to catch up.

This commit is contained in:
Matt K. Fu committed 2013-06-06 17:38:17 +08:00
1 parent f2706ff2c1
commit 7729161123
9 files changed
+71 -15

No files matched your search

@@ -4,9 +4,20 @@ module DefaultWidgetTagHelper
def link_to_more_tag(req,params)
@request = req
@params =params
params.delete :inner
@params = params
params_str ="?"
params.each do |index,param|
if param.is_a?(Array) and !param.blank?
params_str << param.collect{|t| "#{index}[]=#{t}"}.join("&")
params.delete index
end
end
params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" )
content_tag :div,:class=> 'more' do
link_to I18n.t(@more_link[:label_i18n]),eval(@more_link[:path_method])
link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join()
end
end
end
@@ -0,0 +1,21 @@
module FrontEndArrayParamsHelper
#Deal with multi tags and cates that could be sat at both from setting or passed by views like tag cloud.
#Take Tag as example: Those tags which be sat at setting will be pass as params 'tag_ext',and the rest will be pass as 'tag'
#But when the showing process goes to fronend or default widget itself the controller will need to know what data it should use exactly.
#That's why we need tags_and_cates
def tags_and_cates(params)
params["category_id"] = params["category_id"].collect{|t| t.gsub(/\"|\[|\]/,'').split(",").each(&:strip!)}.flatten if params["category_id"].is_a? Array
params["tag_id"] = params["tag_id"].collect{|t| t.gsub(/\"|\[|\]/,'').split(",").each(&:strip!)}.flatten if params["tag_id"].is_a? Array
params["category_id"] = [ params["base_category_id"],params["category_id"]].flatten.reject(&:nil?).reject(&:empty?)
params.delete :base_category_id
params["tag_id"] = [ params["base_tag_id"],params["tag_id"]].flatten.reject(&:nil?).reject(&:empty?)
params.delete :base_tag_id
return params
end
end