This commit is contained in:
BoHung Chiu 2023-07-04 13:33:33 +08:00
parent 9447a64511
commit b8dafc5e47
1 changed files with 54 additions and 53 deletions

View File

@ -73,8 +73,9 @@ class ArchivesController < ApplicationController
if categories == ["all"]
categories = module_app.categories.pluck(:id).map(&:to_s)
end
org_tags = tags
if tags == ["all"]
tags = module_app.tags.sort_by{|tag| ((module_app.asc rescue true) ? tag.sort_number.to_i : -tag.sort_number.to_i)}.map{|tag| tag.id.to_s}
tags = module_app.tags.map{|tag| tag.id.to_s}
tags << nil
end
if params[:data_count].to_i > 0
@ -134,7 +135,7 @@ class ArchivesController < ApplicationController
end
cats_last = cats
else
files_by_category = ArchiveFile.can_display.filter_by_categories(categories, false).filter_by_tags(tags).sorted.group_by(&:category)
files_by_category = ArchiveFile.can_display.filter_by_categories(categories, false).filter_by_tags(org_tags).sorted.group_by(&:category)
each_data_count = []
categories = files_by_category.keys
categories_sort = get_sorted_cat_with_filter(categories, :orm)
@ -182,7 +183,7 @@ class ArchivesController < ApplicationController
end
@@total_pages = (counter.to_f / page_data_count).ceil
else
if page_no!=1
if page_no != 1
cats_last = [Hash[cats[0].map{|k,v| [k,'']}]]
@@total_pages = 0
else