Fix tag cloud search under category filters

This commit is contained in:
Bernie Chiu 2013-11-01 14:37:06 +08:00
parent a7a8a504a7
commit 05b70c932b
2 changed files with 7 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
@page_num = 10 @page_num = 10
end end
get_search_category(params[:search_query]) # get_search_category(params[:search_query])
date_now = Time.now date_now = Time.now
@archive_file_categorys = ArchiveFileCategory.all @archive_file_categorys = ArchiveFileCategory.all

View File

@ -28,7 +28,12 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
date_now = Time.now date_now = Time.now
if !params[:category_id].blank? # binding.pry
if !params[:category_id].blank? && !params[:tag_id].blank?
@archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.where(:tagged_ids.in => params[:tag_id]).any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
elsif !params[:category_id].blank?
@archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true) @archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?