fix for multi select cates and tags
This commit is contained in:
parent
15b9839b76
commit
285119a5f3
|
@ -73,7 +73,7 @@ class Admin::PagePartsController < ApplicationController
|
||||||
params[:page_part][:category] = []
|
params[:page_part][:category] = []
|
||||||
end
|
end
|
||||||
|
|
||||||
params[:page_part][:widget_field].each{|t| t[2] = (t[2]=="true" ? true : false )}
|
params[:page_part][:widget_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page_part][:widget_field].blank?
|
||||||
|
|
||||||
if @part.update_attributes(params[:page_part])
|
if @part.update_attributes(params[:page_part])
|
||||||
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
||||||
|
|
|
@ -20,13 +20,13 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
if params["category_id"].blank?
|
if params["category_id"].blank?
|
||||||
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).entries.collect{|t| t.id}}.flatten
|
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).entries.collect{|t| t.id}}.flatten
|
||||||
else
|
else
|
||||||
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).where(:category_id=>params["category_id"]).available_for_lang(I18n.locale).can_display.collect{|t| t.id}}.flatten
|
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).where(:category_id.in=>params["category_id"]).available_for_lang(I18n.locale).can_display.collect{|t| t.id}}.flatten
|
||||||
end
|
end
|
||||||
result = eval("#{ori_class_name}.where(:id=>result_ids)")
|
result = eval("#{ori_class_name}.where(:id=>result_ids)")
|
||||||
elsif params["category_id"].blank?
|
elsif params["category_id"].blank?
|
||||||
result = eval(@default_widget["query"])
|
result = eval(@default_widget["query"])
|
||||||
else
|
else
|
||||||
result = eval("#{ori_class_name}.where(:category_id=>params['category_id'])")
|
result = eval("#{ori_class_name}.where(:category_id.in=>params['category_id'])")
|
||||||
end
|
end
|
||||||
result.available_for_lang(I18n.locale).can_display
|
result.available_for_lang(I18n.locale).can_display
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue