This commit is contained in:
BoHung Chiu 2021-02-05 08:33:41 +08:00
parent 589dc1adf2
commit 715c51552c
1 changed files with 9 additions and 0 deletions

View File

@ -121,6 +121,15 @@ class ArchivesController < ApplicationController
"url_to_edit" => url_to_edit
}
end
if ArchiveSortOrder.first['sort_order'] #Order with ascending
cats = cats.collect do |cat|
Hash[cat.map{|k,v| [k,k=='archives' ? (v.sort_by{|tp| [(tp['sort_number'].nil? ? Float::INFINITY : tp['sort_number'].to_i),-tp['created_at']]}) : v] }]
end
else
cats = cats.collect do |cat|
Hash[cat.map{|k,v| [k,k=='archives' ? (v.sort_by{|tp| [(tp['sort_number'].nil? ? Float::INFINITY : -tp['sort_number'].to_i),-tp['created_at']]}) : v] }]
end
end
if params[:data_count].to_i <=0
page_data_count = 0
else