fix for multi select cates and tags

This commit is contained in:
Fu Matthew 2013-03-04 19:29:45 +08:00
parent 15b9839b76
commit 285119a5f3
2 changed files with 3 additions and 3 deletions

View File

@ -73,7 +73,7 @@ class Admin::PagePartsController < ApplicationController
params[:page_part][:category] = []
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])
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')

View File

@ -20,13 +20,13 @@ class DefaultWidgetController< OrbitWidgetController
if params["category_id"].blank?
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).entries.collect{|t| t.id}}.flatten
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
result = eval("#{ori_class_name}.where(:id=>result_ids)")
elsif params["category_id"].blank?
result = eval(@default_widget["query"])
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
result.available_for_lang(I18n.locale).can_display
end