From e4888e1421cd8377e6ecb38260dedf092cb5f0f7 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Mon, 26 Dec 2022 10:53:23 +0800 Subject: [PATCH] Adjust code. --- app/controllers/archives_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 7e84fe1..ba56e20 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -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