Update archives_controller.rb
This commit is contained in:
parent
925d25d124
commit
2875a1235a
|
@ -11,7 +11,13 @@ class ArchivesController < ApplicationController
|
|||
if !params['title'].nil?
|
||||
files_by_cateogry = ArchiveFile.where(is_hidden: false).group_by(&:category)
|
||||
categories = files_by_cateogry.keys
|
||||
categories_sort = categories.select{|category| all_categories_id.include? category.id.to_s}
|
||||
categories_sort = []
|
||||
all_categories_id.each do |cat_id|
|
||||
category_selected = categories.select{|category| cat_id == category.id.to_s}
|
||||
if category_selected.length!=0
|
||||
categories_sort << category_selected[0]
|
||||
end
|
||||
end
|
||||
cats_last = []
|
||||
categories_sort.each do |category|
|
||||
url_to_edit = ""
|
||||
|
@ -71,7 +77,13 @@ class ArchivesController < ApplicationController
|
|||
files_by_cateogry = ArchiveFile.where(is_hidden: false).filter_by_categories.filter_by_tags.group_by(&:category)
|
||||
each_data_count = []
|
||||
categories = files_by_cateogry.keys
|
||||
categories_sort = categories.select{|category| all_categories_id.include? category.id.to_s}
|
||||
categories_sort = []
|
||||
all_categories_id.each do |cat_id|
|
||||
category_selected = categories.select{|category| cat_id == category.id.to_s}
|
||||
if category_selected.length!=0
|
||||
categories_sort << category_selected[0]
|
||||
end
|
||||
end
|
||||
cats = categories_sort.collect do |category|
|
||||
url_to_edit = OrbitHelper.user_has_cateogry?(category) ? "/admin/archive_files?filters[category][]=#{category.id.to_s}" : ""
|
||||
archives = files_by_cateogry[category].collect do |archive|
|
||||
|
|
Loading…
Reference in New Issue