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"] if categories == ["all"]
categories = module_app.categories.pluck(:id).map(&:to_s) categories = module_app.categories.pluck(:id).map(&:to_s)
end end
org_tags = tags
if tags == ["all"] 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 tags << nil
end end
if params[:data_count].to_i > 0 if params[:data_count].to_i > 0
@ -134,7 +135,7 @@ class ArchivesController < ApplicationController
end end
cats_last = cats cats_last = cats
else 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 = [] each_data_count = []
categories = files_by_category.keys categories = files_by_category.keys
categories_sort = get_sorted_cat_with_filter(categories, :orm) categories_sort = get_sorted_cat_with_filter(categories, :orm)