Prepare to support ruby 3.3.
This commit is contained in:
parent
6d14f05e15
commit
b3a4dc479b
|
@ -320,9 +320,9 @@ module CustomAnnouncementsHelper
|
|||
if @target_action == "index"
|
||||
filename = overridehtml.nil? ? params[:layout_type] : overridehtml
|
||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
|
||||
if !File.exists?f
|
||||
if !File.exist?(f)
|
||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "index.html.erb")
|
||||
if !File.exists?f
|
||||
if !File.exist?(f)
|
||||
return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe
|
||||
end
|
||||
end
|
||||
|
@ -362,7 +362,7 @@ module CustomAnnouncementsHelper
|
|||
else
|
||||
filename = overridehtml.nil? ? @target_action : overridehtml
|
||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
|
||||
if File.exists?f
|
||||
if File.exist?(f)
|
||||
file = File.open(f)
|
||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||
file.close
|
||||
|
@ -464,7 +464,7 @@ module CustomAnnouncementsHelper
|
|||
layout_types = []
|
||||
@key = Site.first.template
|
||||
f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/info.json")
|
||||
if File.exists?f
|
||||
if File.exist?(f)
|
||||
info = File.read(f)
|
||||
hash = JSON.parse(info) rescue {}
|
||||
frontends = hash["frontend"] || []
|
||||
|
|
|
@ -2,6 +2,7 @@ require "yaml"
|
|||
module CustomAnnouncement
|
||||
class Engine < ::Rails::Engine
|
||||
initializer "custom_announcement" do
|
||||
Rails.application.config.to_prepare do
|
||||
begin
|
||||
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||
data = {}
|
||||
|
@ -152,3 +153,4 @@ module CustomAnnouncement
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue