1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Change template rendering engine

This commit is contained in:
Amadeus Folego 2016-07-29 19:41:42 -03:00
parent 44614b5da2
commit a9f0cca87d
2 changed files with 5 additions and 5 deletions

View file

@ -106,7 +106,7 @@ module Sidekiq
Sidekiq::WebApplication.helpers WebHelpers
Sidekiq::WebApplication.helpers Sidekiq::Paginator
ERB.new(File.read Web::LAYOUT).def_method(WebAction, '_render')
Sidekiq::WebAction.class_eval "def _render\n#{ERB.new(File.read(Web::LAYOUT)).src}\nend"
end
if defined?(::ActionDispatch::Request::Session) &&

View file

@ -51,9 +51,9 @@ module Sidekiq
def erb(content, options = {})
if content.kind_of? Symbol
filename = "#{Web.settings.views}/#{content}.erb"
unless content = @@files[filename]
content = @@files[filename] = ERB.new(File.read(filename))
unless respond_to?(:"_erb_#{content}")
src = ERB.new(File.read("#{Web.settings.views}/#{content}.erb")).src
WebAction.class_eval("def _erb_#{content}\n#{src}\n end")
end
end
@ -92,7 +92,7 @@ module Sidekiq
if file.kind_of?(String)
ERB.new(file).result(binding)
else
file.result(binding)
send(:"_erb_#{file}")
end
end
end