accelerate announcement

This commit is contained in:
邱博亞 2021-11-07 12:22:45 +08:00
parent 9211ab2cf7
commit 325100664d
1 changed files with 7 additions and 7 deletions

View File

@ -183,16 +183,16 @@ class AnnouncementsController < ApplicationController
cats_translations = [["all",I18n.t(:all)]] + cats_translations
end
cats_translations = cats_translations.to_h
cats_relations = cats_translations.map{|cat_id,t|
if cat_id == "all"
t = "all"
end
[cat_id,t]
}.to_h
home_page = subpart.page_part.page rescue Page.first
if cats.include?("all")
cats_relations = cats_translations.clone
cats_relations['all'] = 'all'
else
cats_relations = cats_translations
end
page_url = (subpart.get_read_more_page_url rescue nil)
locale = I18n.locale.to_s
if page_url.nil?
home_page = subpart.page_part.page rescue Page.first
page = nil
if home_page.respond_to?(:find_page)
page = home_page.find_page(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil