Merge branch 'design_team' of github.com:Rulingcom/orbit into design_team

This commit is contained in:
Christophe Vilayphiou 2012-05-04 19:16:57 +08:00
commit 3ef81c520e
1 changed files with 7 additions and 14 deletions

View File

@ -62,30 +62,23 @@ class OrbitBackendController< ApplicationController
case key
when 'status'
a = Array.new
objects.each do |bulletin|
objects.each do |object|
value.each do |v|
case v
when 'pending'
a << bulletin if bulletin.is_checked.nil?
when 'rejected'
a << bulletin if bulletin.is_checked.eql?(false)
else
a << bulletin if bulletin[v]
end
a << object if object[v]
end
end
objects = a.uniq
when 'categories'
a = Array.new
objects.each do |bulletin|
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s)
objects.each do |object|
a << object if value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s)
end
objects = a.uniq
when 'tags'
a = Array.new
objects.each do |bulletin|
bulletin.tags.each do |tag|
a << bulletin if value.include?(tag.id.to_s)
objects.each do |object|
object.tags.each do |tag|
a << object if value.include?(tag.id.to_s)
end
end
objects = a.uniq