Adjust code.

This commit is contained in:
BoHung Chiu 2022-12-26 10:53:23 +08:00
parent 1eecd099f4
commit e4888e1421
1 changed files with 5 additions and 5 deletions

View File

@ -41,7 +41,7 @@ class ArchivesController < ApplicationController
if !params['title'].nil?
files_by_category = ArchiveFile.can_display.sorted.group_by(&:category)
categories = files_by_category.keys
categories_sort = get_sorted_cat_with_filter(categories,'orm')
categories_sort = get_sorted_cat_with_filter(categories, :orm)
categories_sort.each_with_index do |category, cat_idx|
url_to_edit = ""
flag = false
@ -144,7 +144,7 @@ class ArchivesController < ApplicationController
files_by_category = ArchiveFile.can_display.filter_by_categories(categories).filter_by_tags(tags).sorted.group_by(&:category)
each_data_count = []
categories = files_by_category.keys
categories_sort = get_sorted_cat_with_filter(categories,'orm')
categories_sort = get_sorted_cat_with_filter(categories, :orm)
cats = categories_sort.collect.with_index do |category, cat_idx|
url_to_edit = OrbitHelper.user_has_cateogry?(category) ? "/admin/archive_files?filters[category][]=#{category.id.to_s}" : ""
serial_number = 0
@ -332,7 +332,7 @@ class ArchivesController < ApplicationController
categorie_ids = []
if categories.first == "all"
categories = OrbitHelper.widget_module_app.categories
categories_sort = get_sorted_cat_with_filter(categories,'orm')
categories_sort = get_sorted_cat_with_filter(categories, :orm)
@categories = categories_sort.collect do |cat|
cat_id = cat.id.to_s
categorie_ids << cat_id
@ -342,7 +342,7 @@ class ArchivesController < ApplicationController
}
end
else
categories_sort = get_sorted_cat_with_filter(categories,'id')
categories_sort = get_sorted_cat_with_filter(categories, :id)
@categories = categories_sort.collect do |cat|
cat_id = cat.id.to_s
categorie_ids << cat_id
@ -392,7 +392,7 @@ class ArchivesController < ApplicationController
all_categories_id = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat|
cat.category_id.to_s
end
if cat_type=='id'
if cat_type == :id
categories_temp = ModuleApp.where(:key => "archive").first.categories
categories = categories_temp.select{|cat| categories.include? cat.id.to_s}
end