forked from spen/seminar
Prepare to support ruby 3.3.
This commit is contained in:
parent
228fcd8781
commit
1ae15033a8
|
@ -320,9 +320,9 @@ module CustomAnnouncementsHelper
|
||||||
if @target_action == "index"
|
if @target_action == "index"
|
||||||
filename = overridehtml.nil? ? params[:layout_type] : overridehtml
|
filename = overridehtml.nil? ? params[:layout_type] : overridehtml
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
|
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")
|
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
|
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
|
||||||
end
|
end
|
||||||
|
@ -362,7 +362,7 @@ module CustomAnnouncementsHelper
|
||||||
else
|
else
|
||||||
filename = overridehtml.nil? ? @target_action : overridehtml
|
filename = overridehtml.nil? ? @target_action : overridehtml
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
|
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)
|
file = File.open(f)
|
||||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||||
file.close
|
file.close
|
||||||
|
@ -464,7 +464,7 @@ module CustomAnnouncementsHelper
|
||||||
layout_types = []
|
layout_types = []
|
||||||
@key = Site.first.template
|
@key = Site.first.template
|
||||||
f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/info.json")
|
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)
|
info = File.read(f)
|
||||||
hash = JSON.parse(info) rescue {}
|
hash = JSON.parse(info) rescue {}
|
||||||
frontends = hash["frontend"] || []
|
frontends = hash["frontend"] || []
|
||||||
|
|
|
@ -2,6 +2,7 @@ require "yaml"
|
||||||
module CustomAnnouncement
|
module CustomAnnouncement
|
||||||
class Engine < ::Rails::Engine
|
class Engine < ::Rails::Engine
|
||||||
initializer "custom_announcement" do
|
initializer "custom_announcement" do
|
||||||
|
Rails.application.config.to_prepare do
|
||||||
begin
|
begin
|
||||||
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||||
data = {}
|
data = {}
|
||||||
|
@ -151,4 +152,5 @@ module CustomAnnouncement
|
||||||
# s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
|
# s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -1,6 +1,7 @@
|
||||||
module CustomGallery
|
module CustomGallery
|
||||||
class Engine < ::Rails::Engine
|
class Engine < ::Rails::Engine
|
||||||
initializer "custom_gallery" do
|
initializer "custom_gallery" do
|
||||||
|
Rails.application.config.to_prepare do
|
||||||
begin
|
begin
|
||||||
translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||||
data = {}
|
data = {}
|
||||||
|
@ -21,7 +22,7 @@ module CustomGallery
|
||||||
puts ['error in custom_gallery',e]
|
puts ['error in custom_gallery',e]
|
||||||
end
|
end
|
||||||
|
|
||||||
require File.expand_path('../../../app/models/custom_album_setting', __FILE__)
|
require File.join(CustomGallery::Engine.root, 'app/models/custom_album_setting')
|
||||||
if defined?(CustomAlbumSetting)
|
if defined?(CustomAlbumSetting)
|
||||||
if CustomAlbumSetting.first.nil?
|
if CustomAlbumSetting.first.nil?
|
||||||
CustomAlbumSetting.create()
|
CustomAlbumSetting.create()
|
||||||
|
@ -92,4 +93,5 @@ module CustomGallery
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Seminar
|
module Seminar
|
||||||
class Engine < ::Rails::Engine
|
class Engine < ::Rails::Engine
|
||||||
initializer "seminar" do
|
initializer "seminar" do
|
||||||
|
Rails.application.config.to_prepare do
|
||||||
OrbitApp.registration "Seminar", :type => "ModuleApp" do
|
OrbitApp.registration "Seminar", :type => "ModuleApp" do
|
||||||
module_label "seminar.seminar"
|
module_label "seminar.seminar"
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
@ -49,7 +50,7 @@ module Seminar
|
||||||
:active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'},
|
:active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'},
|
||||||
:available_for => 'users'
|
:available_for => 'users'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue