Prepare to support ruby 3.3.
This commit is contained in:
parent
a55848b554
commit
6c89f33caa
|
@ -334,9 +334,9 @@ module EventNewsHelper
|
|||
if @target_action == "index"
|
||||
filename = File.basename(overridehtml.nil? ? params[:layout_type] : overridehtml)
|
||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news_mod', "#{filename}.html.erb")
|
||||
if !File.exists?f
|
||||
if !File.exist?(f)
|
||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news_mod', "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
|
||||
|
@ -376,7 +376,7 @@ module EventNewsHelper
|
|||
else
|
||||
filename = overridehtml.nil? ? @target_action : overridehtml
|
||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news_mod', "#{filename}.html.erb")
|
||||
if File.exists?f
|
||||
if File.exist?(f)
|
||||
file = File.open(f)
|
||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||
file.close
|
||||
|
@ -478,7 +478,7 @@ module EventNewsHelper
|
|||
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"] || []
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
require "yaml"
|
||||
module EventNewsMod
|
||||
class Engine < ::Rails::Engine
|
||||
initializer "event_news_mod" do
|
||||
Rails.application.config.to_prepare do
|
||||
require "yaml"
|
||||
begin
|
||||
translate_data = Dir["#{EventNewsMod::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||
data = {}
|
||||
|
@ -194,3 +195,4 @@ module EventNewsMod
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue