Fix show_widget.

This commit is contained in:
邱博亞 2024-04-17 21:48:24 +08:00
parent c99f1b9176
commit 74eb764277
1 changed files with 5 additions and 4 deletions

View File

@ -945,10 +945,11 @@ class AnnouncementsController < ApplicationController
else else
@categories = params[:categories] @categories = params[:categories]
end end
begin root_page = Page.root
params[:url] = Page.first.find_page(:module=>"announcement",:enabled_for=>I18n.locale.to_s).first.url rescue Page.where(:module=>"announcement",:enabled_for=>I18n.locale.to_s).first.url annc_params = {:module=>"announcement", :enabled_for=>I18n.locale.to_s}
rescue annc_page = (root_page.respond_to?(:find_page) ? root_page.find_page(annc_params).first : Page.where(annc_params).first)
end OrbitHelper.set_page(annc_page) if OrbitHelper.respond_to?(:set_page)
params[:url] = (annc_page ? annc_page.url : nil)
OrbitHelper.set_site_locale(I18n.locale) OrbitHelper.set_site_locale(I18n.locale)
OrbitHelper.set_current_widget_module("announcement") OrbitHelper.set_current_widget_module("announcement")
OrbitHelper.set_params(params,current_user) OrbitHelper.set_params(params,current_user)