Fix tag cloud search under category filters

This commit is contained in:
thomaschen 2013-11-01 15:38:49 +08:00
parent d832f4c4b1
commit e5fccb33bf
1 changed files with 4 additions and 2 deletions

View File

@ -27,8 +27,10 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
@category_id = @part.category
date_now = Time.now
if !params[:category_id].blank?
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_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
elsif !params[:tag_id].blank?