apply tags and cates for fronted. from now app developer can use param category_id and tag_id freely.
This commit is contained in:
parent
7729161123
commit
dd206437d8
|
@ -1,10 +1,8 @@
|
||||||
class OrbitWidgetController< OrbitFrontendComponentController
|
class OrbitWidgetController< OrbitFrontendComponentController
|
||||||
include FrontEndArrayParamsHelper
|
include FrontEndArrayParamsHelper
|
||||||
|
before_filter {get_tags_and_cates(params)}
|
||||||
|
|
||||||
before_filter :get_tags_and_cates
|
def get_tags_and_cates(params)
|
||||||
|
|
||||||
def get_tags_and_cates
|
|
||||||
binding.pry
|
|
||||||
params = tags_and_cates(params)
|
params = tags_and_cates(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ module FrontEndArrayParamsHelper
|
||||||
#That's why we need tags_and_cates
|
#That's why we need tags_and_cates
|
||||||
|
|
||||||
def tags_and_cates(params)
|
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["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["tag_id"] = params["tag_id"].collect{|t| t.gsub(/\"|\[|\]/,'').split(",").each(&:strip!)}.flatten if params["tag_id"].is_a? Array
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue