parent
dacaf2a18d
commit
08cbf76447
|
@ -17,9 +17,10 @@ class ArchivesController < ApplicationController
|
||||||
categories = files_by_cateogry.keys
|
categories = files_by_cateogry.keys
|
||||||
all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil)
|
all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil)
|
||||||
all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc')
|
all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc')
|
||||||
categories_sort = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat|
|
all_categories_id = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat|
|
||||||
categories.select{|category| category.id.to_s == cat.category_id.to_s}[0]
|
cat.category_id.to_s
|
||||||
end
|
end
|
||||||
|
categories_sort = categories.select{|category| all_categories_id.include? category.id.to_s}[0]
|
||||||
cats_last = []
|
cats_last = []
|
||||||
categories_sort.each do |category|
|
categories_sort.each do |category|
|
||||||
url_to_edit = ""
|
url_to_edit = ""
|
||||||
|
@ -81,9 +82,10 @@ class ArchivesController < ApplicationController
|
||||||
categories = files_by_cateogry.keys
|
categories = files_by_cateogry.keys
|
||||||
all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil)
|
all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil)
|
||||||
all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc')
|
all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc')
|
||||||
categories_sort = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat|
|
all_categories_id = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat|
|
||||||
categories.select{|category| category.id.to_s == cat.category_id.to_s}[0]
|
cat.category_id.to_s
|
||||||
end
|
end
|
||||||
|
categories_sort = categories.select{|category| all_categories_id.include? category.id.to_s}[0]
|
||||||
cats = categories_sort.collect do |category|
|
cats = categories_sort.collect do |category|
|
||||||
url_to_edit = OrbitHelper.user_has_cateogry?(category) ? "/admin/archive_files?filters[category][]=#{category.id.to_s}" : ""
|
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|
|
archives = files_by_cateogry[category].collect do |archive|
|
||||||
|
|
Loading…
Reference in New Issue