From e16e227a4a48394d8b67784943b6e17197317cd1 Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 11 Oct 2021 13:57:17 +0800 Subject: [PATCH] Add tags and cats trans cache in kernel. --- app/controllers/announcements_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 27c8bd8..a5e06ae 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -171,12 +171,14 @@ class AnnouncementsController < ApplicationController end cats = cats.uniq tags = tags.uniq - tags_translations = Tag.where(:id.in=>tags).map{|t| [t.id.to_s,t.name]} + tags_translations = (subpart.get_tags_translations(false,false) rescue nil) + tags_translations = Tag.where(:id.in=>tags).map{|t| [t.id.to_s,t.name]} if tags_translations.nil? if tags.include?("all") tags_translations = [["all",I18n.t(:all)]] + tags_translations end tags_translations = tags_translations.to_h - cats_translations = Category.where(:id.in=>cats).map{|c| [c.id.to_s,c.title]} + cats_translations = (subpart.get_cats_translations(false,false) rescue nil) + cats_translations = Category.where(:id.in=>cats).map{|c| [c.id.to_s,c.title]} if cats_translations.nil? if cats.include?("all") cats_translations = [["all",I18n.t(:all)]] + cats_translations end