From 4cc1989932303ff91ee81b8e06f4f28930e32c0d Mon Sep 17 00:00:00 2001 From: Bohung Date: Wed, 29 Sep 2021 19:34:56 +0800 Subject: [PATCH] Fix tag sort. --- app/controllers/archives_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 7fc2662..fd42ede 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -87,7 +87,7 @@ class ArchivesController < ApplicationController categories = module_app.categories.pluck(:id).map(&:to_s) end if tags == ["all"] - tags = module_app.tags.pluck(:id).map(&:to_s) + tags = module_app.tags.sort_by{|tag| ((module_app.asc rescue true) ? tag.sort_number.to_i : -tag.sort_number.to_i)}.map{|tag| tag.id.to_s} end if params[:data_count].to_i <=0 page_data_count = 0