From 251e6ee58397f0682ab1f242b53a8bac0045adee Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 6 Nov 2015 18:17:53 +0800 Subject: [PATCH] sort fix --- app/controllers/archives_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 9c81ac7..7df551f 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -8,7 +8,7 @@ class ArchivesController < ApplicationController page.save end end - files_by_cateogry = ArchiveFile.filter_by_categories.filter_by_tags.group_by(&:category) + files_by_cateogry = ArchiveFile.filter_by_categories.filter_by_tags.asc(:sort_number).group_by(&:category) categories = files_by_cateogry.keys cats = categories.collect do |category| url_to_edit = OrbitHelper.user_has_cateogry?(category) ? "/admin/archive_files?filters[category][]=#{category.id.to_s}" : "" @@ -64,9 +64,9 @@ 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}).group_by(&:category) + 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) else - files_by_cateogry = ArchiveFile.where(:category_id.in => OrbitHelper.widget_categories).with_tags(OrbitHelper.widget_tags).group_by(&:category) + files_by_cateogry = ArchiveFile.where(:category_id.in => OrbitHelper.widget_categories).with_tags(OrbitHelper.widget_tags).asc(:sort_number).group_by(&:category) end cats = files_by_cateogry.keys.collect do |cat| files_by_category_tag = files_by_cateogry[cat].group_by(&:tags)