Prepare to support ruby 3.3.
This commit is contained in:
parent
c8c8738800
commit
193e98e3b1
|
@ -2,6 +2,7 @@ require "yaml"
|
||||||
module Patchfile
|
module Patchfile
|
||||||
class Engine < ::Rails::Engine
|
class Engine < ::Rails::Engine
|
||||||
initializer "patchfile" do
|
initializer "patchfile" do
|
||||||
|
Rails.application.config.to_prepare do
|
||||||
OrbitApp.registration "Patchfile", :type => "ModuleApp" do
|
OrbitApp.registration "Patchfile", :type => "ModuleApp" do
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
# taggable "patchfilefield"
|
# taggable "patchfilefield"
|
||||||
|
@ -30,3 +31,4 @@ module Patchfile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
|
@ -710,9 +710,9 @@ module ApplicationHelper
|
||||||
filename = overridehtml.nil? ? File.basename(params[:layout_type]) : overridehtml
|
filename = overridehtml.nil? ? File.basename(params[:layout_type]) : overridehtml
|
||||||
module_name = File.basename(params[:target_controller]).singularize
|
module_name = File.basename(params[:target_controller]).singularize
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "#{filename}.html.erb")
|
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "#{filename}.html.erb")
|
||||||
if !File.exists?f
|
if !File.exist?(f)
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "index.html.erb")
|
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "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
|
||||||
|
@ -771,7 +771,7 @@ module ApplicationHelper
|
||||||
filename = overridehtml.nil? ? File.basename(params[:target_action]) : overridehtml
|
filename = overridehtml.nil? ? File.basename(params[:target_action]) : overridehtml
|
||||||
module_name = File.basename(params[:target_controller]).singularize
|
module_name = File.basename(params[:target_controller]).singularize
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "#{filename}.html.erb")
|
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "#{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
|
||||||
|
@ -977,7 +977,7 @@ module ApplicationHelper
|
||||||
def create_pagination(total_pages)
|
def create_pagination(total_pages)
|
||||||
file = File.join(Rails.root, 'app', 'templates', "#{@key}", 'home', "pagination.html.erb")
|
file = File.join(Rails.root, 'app', 'templates', "#{@key}", 'home', "pagination.html.erb")
|
||||||
html = ""
|
html = ""
|
||||||
if File.exists?file
|
if File.exist?(file)
|
||||||
file = File.open(file)
|
file = File.open(file)
|
||||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||||
file.close
|
file.close
|
||||||
|
@ -1056,7 +1056,7 @@ module ApplicationHelper
|
||||||
url_dir_name = URI.decode(url_dir_name)
|
url_dir_name = URI.decode(url_dir_name)
|
||||||
url_dir_name = (url_dir_name == "/" ? "home" : url_dir_name.sub("/","").gsub("/","_").gsub("-","_").gsub(" ","_"))
|
url_dir_name = (url_dir_name == "/" ? "home" : url_dir_name.sub("/","").gsub("/","_").gsub("-","_").gsub(" ","_"))
|
||||||
directory_name = "tmp/debug/#{url_dir_name}"
|
directory_name = "tmp/debug/#{url_dir_name}"
|
||||||
FileUtils.mkdir_p(directory_name) unless File.exists?(directory_name)
|
FileUtils.mkdir_p(directory_name) unless File.exist?(directory_name)
|
||||||
fn = "#{directory_name}/#{controller_name}_#{action_name}.html"
|
fn = "#{directory_name}/#{controller_name}_#{action_name}.html"
|
||||||
error_trace_spans = ""
|
error_trace_spans = ""
|
||||||
e.backtrace.each do |bt|
|
e.backtrace.each do |bt|
|
||||||
|
|
Loading…
Reference in New Issue