mirror of
https://github.com/redmine/redmine.git
synced 2025-11-16 18:26:02 +01:00
Merged Rails 2.1 compatibility branch.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1623 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
8
vendor/plugins/rfpdf/init.rb
vendored
8
vendor/plugins/rfpdf/init.rb
vendored
@@ -1,3 +1,9 @@
|
||||
require 'rfpdf'
|
||||
|
||||
ActionView::Base::register_template_handler 'rfpdf', RFPDF::View
|
||||
begin
|
||||
ActionView::Template::register_template_handler 'rfpdf', RFPDF::View
|
||||
rescue NameError
|
||||
# Rails < 2.1
|
||||
RFPDF::View.backward_compatibility_mode = true
|
||||
ActionView::Base::register_template_handler 'rfpdf', RFPDF::View
|
||||
end
|
||||
|
||||
12
vendor/plugins/rfpdf/lib/rfpdf/view.rb
vendored
12
vendor/plugins/rfpdf/lib/rfpdf/view.rb
vendored
@@ -30,6 +30,8 @@
|
||||
module RFPDF
|
||||
|
||||
class View
|
||||
@@backward_compatibility_mode = false
|
||||
cattr_accessor :backward_compatibility_mode
|
||||
|
||||
def initialize(action_view)
|
||||
@action_view = action_view
|
||||
@@ -45,6 +47,14 @@ module RFPDF
|
||||
:temp_dir => "#{File.expand_path(RAILS_ROOT)}/tmp"
|
||||
}.merge(@action_view.controller.instance_eval{ @options_for_rfpdf } || {}).with_indifferent_access
|
||||
end
|
||||
|
||||
def self.compilable?
|
||||
false
|
||||
end
|
||||
|
||||
def compilable?
|
||||
self.class.compilable?
|
||||
end
|
||||
|
||||
def render(template, local_assigns = {})
|
||||
@pdf_name = "Default.pdf" if @pdf_name.nil?
|
||||
@@ -66,7 +76,7 @@ module RFPDF
|
||||
local_assigns.each do |key,val|
|
||||
class << self; self; end.send(:define_method,key){ val }
|
||||
end
|
||||
ERB.new(template).result(binding)
|
||||
ERB.new(@@backward_compatibility_mode == true ? template : template.source).result(binding)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user