mirror of
https://github.com/lloeki/tilt-pdf.git
synced 2025-12-06 10:34:41 +01:00
first version
This commit is contained in:
commit
e2c2846b81
11 changed files with 303 additions and 0 deletions
25
lib/tilt/pdf/rails.rb
Normal file
25
lib/tilt/pdf/rails.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
require 'tilt-pdf'
|
||||
require 'action_view/template/handlers'
|
||||
|
||||
module ActionView
|
||||
class Template
|
||||
module Handlers
|
||||
class PDFTemplate
|
||||
class_attribute :default_format
|
||||
self.default_format = :pdf
|
||||
|
||||
def call(template)
|
||||
"Tilt.new('#{template.identifier}').render(self)"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
register_template_handler :rpdf, Handlers::PDFTemplate.new
|
||||
end
|
||||
end
|
||||
|
||||
module Tilt::PDFTemplate::Rails
|
||||
class Railtie < ::Rails::Railtie
|
||||
config.app_generators.template_engine :rpdf
|
||||
end
|
||||
end
|
||||
6
lib/tilt/pdf/version.rb
Normal file
6
lib/tilt/pdf/version.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module Tilt
|
||||
module PDF
|
||||
VERSION = '0.1.0'
|
||||
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue