fix sort error for front page
This commit is contained in:
parent
3c57c25b45
commit
e4ba43123c
|
@ -14,15 +14,15 @@ class ArchivesController < ApplicationController
|
|||
end
|
||||
params = OrbitHelper.params
|
||||
if !params['title'].nil?
|
||||
files_by_cateogry = ArchiveFile.where(is_hidden: false).group_by(&:category)
|
||||
categories = files_by_cateogry.keys
|
||||
files_by_category = ArchiveFile.where(is_hidden: false).order_by(:created_at => "desc").group_by(&:category)
|
||||
categories = files_by_category.keys
|
||||
categories_sort = get_sorted_cat_with_filter(categories,'orm')
|
||||
cats_last = []
|
||||
categories_sort.each do |category|
|
||||
url_to_edit = ""
|
||||
flag = false
|
||||
archives = []
|
||||
files_by_cateogry[category].each do |archive|
|
||||
files_by_category[category].each do |archive|
|
||||
if archive.title == params['title']
|
||||
flag = true
|
||||
statuses = archive.statuses_with_classname.collect do |status|
|
||||
|
@ -73,13 +73,13 @@ class ArchivesController < ApplicationController
|
|||
page.save
|
||||
end
|
||||
end
|
||||
files_by_cateogry = ArchiveFile.where(is_hidden: false).filter_by_categories.filter_by_tags.group_by(&:category)
|
||||
files_by_category = ArchiveFile.where(is_hidden: false).filter_by_categories.filter_by_tags.group_by(&:category)
|
||||
each_data_count = []
|
||||
categories = files_by_cateogry.keys
|
||||
categories = files_by_category.keys
|
||||
categories_sort = get_sorted_cat_with_filter(categories,'orm')
|
||||
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|
|
||||
archives = files_by_category[category].collect do |archive|
|
||||
statuses = archive.statuses_with_classname.collect do |status|
|
||||
{
|
||||
"status" => status["name"] || "",
|
||||
|
@ -218,12 +218,12 @@ class ArchivesController < ApplicationController
|
|||
def group_by_category
|
||||
cat_id = OrbitHelper.widget_categories.map {|cat_id| cat_id.to_s}
|
||||
if OrbitHelper.widget_tags.first == "all"
|
||||
files_by_cateogry = ArchiveFile.where(:category_id.in => OrbitHelper.widget_categories).with_tags(OrbitHelper.widget_module_app.tags.collect{|tag| tag.id.to_s}).asc(:sort_number).group_by(&:category)
|
||||
files_by_category = ArchiveFile.where(:category_id.in => OrbitHelper.widget_categories).with_tags(OrbitHelper.widget_module_app.tags.collect{|tag| tag.id.to_s}).asc(:sort_number).group_by(&:category)
|
||||
else
|
||||
files_by_cateogry = ArchiveFile.where(:category_id.in => OrbitHelper.widget_categories).with_tags(OrbitHelper.widget_tags).asc(:sort_number).group_by(&:category)
|
||||
files_by_category = ArchiveFile.where(:category_id.in => OrbitHelper.widget_categories).with_tags(OrbitHelper.widget_tags).asc(:sort_number).group_by(&:category)
|
||||
end
|
||||
F cats = files_by_cateogry.keys.collect do |cat|
|
||||
files_by_category_tag = files_by_cateogry[cat].group_by(&:tags)
|
||||
cats = files_by_category.keys.collect do |cat|
|
||||
files_by_category_tag = files_by_category[cat].group_by(&:tags)
|
||||
|
||||
ts = []
|
||||
archive_counts = 0
|
||||
|
|
Loading…
Reference in New Issue