seven1m-prawn_template_handler 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown ADDED
@@ -0,0 +1,34 @@
1
+ PrawnTemplateHandler
2
+ ====================
3
+
4
+ Uber simple template handler for Prawn PDF views.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ Add the following to your environment.rb Initializer block:
10
+
11
+ config.gem 'seven1m-prawn_template_handler', :source => 'http://gems.github.com', :lib => 'prawn_template_handler'
12
+
13
+ Or, use the traditional plugin install method:
14
+
15
+ script/plugin install git://github.com/seven1m/prawn_template_handler.git
16
+
17
+ Usage
18
+ -----
19
+
20
+ In show.pdf.prawn:
21
+
22
+ pdf.move_down 200
23
+ pdf.text 'Hello World'
24
+
25
+ If you need to specify document options, add a @pdf line to your show method (optional):
26
+
27
+ def show
28
+ @pdf = Prawn::Document.new(:page_layout => :landscape)
29
+ end
30
+
31
+ License
32
+ -------
33
+
34
+ Released into the Public Domain.
@@ -0,0 +1,19 @@
1
+ module ActionView
2
+ module TemplateHandlers
3
+ class Prawn < TemplateHandler
4
+ include Compilable
5
+
6
+ def compile(template)
7
+ <<-SRC
8
+ controller.response.content_type ||= Mime::PDF
9
+ pdf = @pdf || Prawn::Document.new
10
+ #{template.source}
11
+ pdf.render
12
+ SRC
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ Mime::Type.register "application/pdf", :pdf
19
+ ActionView::Template.register_template_handler 'prawn', ActionView::TemplateHandlers::Prawn
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: seven1m-prawn_template_handler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tim Morgan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-26 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Uber simple template handler for Prawn views in Rails
17
+ email: tim@timmorgan.org
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README.markdown
26
+ - lib/prawn_template_handler.rb
27
+ has_rdoc: false
28
+ homepage: http://github.com/seven1m/prawn_template_handler
29
+ post_install_message:
30
+ rdoc_options: []
31
+
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: "0"
39
+ version:
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ requirements: []
47
+
48
+ rubyforge_project:
49
+ rubygems_version: 1.2.0
50
+ signing_key:
51
+ specification_version: 2
52
+ summary: Uber simple template handler for Prawn views in Rails
53
+ test_files: []
54
+