chili_pdf 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
+ === 0.2.0 / 2011-05-23
2
+
3
+ * Fixed layout & stylesheet inclusions
4
+ * HTML template for PDF rendering was not being wrapped in a layout
5
+ * Added ChiliPdfHelper#chili_pdf_stylesheets to inline (fix)
6
+ CSS inclusions in generated PDFs
7
+ * Added HTML debugging (add ?debug=true to URL)
8
+ * Removed blank spaces from default filename on PDF
9
+ * Fixed 'rake chili_pdf:install' so it will remove an existing plugin
10
+ asset directory before attempting to symlink.
11
+
1
12
  == 0.1.0 2011-05-20
2
13
 
3
14
  * 1 major enhancement:
data/Manifest.txt CHANGED
@@ -6,6 +6,7 @@ Manifest.txt
6
6
  README.md
7
7
  Rakefile
8
8
  app/controllers/extended_wiki_controller.rb
9
+ app/helpers/chili_pdf_helper.rb
9
10
  app/views/extended_wiki/show.pdf.html.erb
10
11
  app/views/layouts/pdf.pdf.erb
11
12
  assets/stylesheets/pdf.css
data/README.md CHANGED
@@ -73,7 +73,7 @@ config.gem 'chili_pdf'
73
73
  In your 'Rakefile', add:
74
74
 
75
75
  ``` ruby
76
- require 'chili_videos'
76
+ require 'tasks/chili_pdf_tasks'
77
77
  ```
78
78
 
79
79
  Run the installation rake task (installs assets)
@@ -95,7 +95,7 @@ RAILS_ENV=production rake chili_pdf:uninstall
95
95
  In your 'Rakefile', remove:
96
96
 
97
97
  ``` ruby
98
- require 'chili_pdf'
98
+ require 'tasks/chili_pdf_tasks'
99
99
  ```
100
100
 
101
101
  In your 'config/environment.rb', remove:
@@ -1,22 +1,26 @@
1
1
  class ExtendedWikiController < WikiController
2
2
  unloadable
3
3
 
4
+ helper 'chili_pdf'
5
+
4
6
  def show
5
7
  super
6
8
  unless performed? # Prevent double render
7
9
  respond_to do |format|
8
10
  format.html {render :template => 'wiki/show'}
9
11
  format.pdf {
10
- render :pdf => "#{@project.name.underscore}_#{@page.title}",
12
+ filename = "#{@project.name.underscore}_#{@page.title}".gsub(/\s/,'')
13
+ render :pdf => filename,
11
14
  :template => 'extended_wiki/show.pdf.html.erb',
12
15
  :page_size => "Letter",
13
- :user_style_sheet => "#{Rails.root}/public/plugin_assets/chili_pdf/stylesheets/pdf.css",
16
+ :show_as_html => params[:debug],
14
17
  :margin => {
15
18
  :top => "0.5in",
16
19
  :bottom => "0.5in",
17
20
  :left => "0.5in",
18
21
  :right => "0.5in"
19
- }
22
+ },
23
+ :layout => 'pdf.pdf.erb'
20
24
  }
21
25
  end
22
26
  end
@@ -0,0 +1,10 @@
1
+ module ChiliPdfHelper
2
+ # Taken almost verbatim from wicked_pdf gem
3
+ def chili_pdf_stylesheets
4
+ css_dir = Rails.root.join('public','plugin_assets', 'chili_pdf', 'stylesheets')
5
+ css_file_list = Dir.glob("#{css_dir}/*css")
6
+ css_file_list.collect { |css_file|
7
+ "<style type='text/css'>#{File.read(css_file)}</style>"
8
+ }.join("\n")
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  <% content_for :header_tags do %>
2
- <%= stylesheet_link_tag '/plugin_assets/chili_pdf/stylesheets/videos' %>
2
+ <%= chili_pdf_stylesheets %>
3
3
  <% end %>
4
4
 
5
5
  <%= render(:partial => "wiki/content", :locals => {:content => @content}) %>
@@ -15,6 +15,7 @@
15
15
 
16
16
  <!-- Mobile viewport optimized: j.mp/bplateviewport -->
17
17
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
18
+ <%= yield(:header_tags) %>
18
19
  </head>
19
20
 
20
21
  <body>
data/lib/chili_pdf.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ChiliPDF
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -22,6 +22,7 @@ class ChiliPDFTasks < Rake::TaskLib
22
22
  task :symlink_assets => [:environment] do
23
23
  # HACK: Symlinks the files from plugindir/assets to the appropriate place in
24
24
  # the rails application
25
+ remove_symlink(asset_destination_dir)
25
26
  puts "Symlinking assets (stylesheets, etc)..."
26
27
  add_symlink asset_source_dir, asset_destination_dir
27
28
  end
@@ -50,7 +51,8 @@ class ChiliPDFTasks < Rake::TaskLib
50
51
  end
51
52
 
52
53
  def remove_symlink(symlink_file)
53
- system("unlink #{symlink_file}") if File.exists?(symlink_file)
54
+ File.unlink(symlink_file)
55
+ rescue Errno::ENOENT # file did not exist...ignore this error
54
56
  end
55
57
 
56
58
  def add_symlink(source, destination)
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chili_pdf
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Kersten
@@ -36,7 +36,7 @@ cert_chain:
36
36
  NVADJA==
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-05-20 00:00:00 -05:00
39
+ date: 2011-05-23 00:00:00 -05:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
@@ -92,6 +92,7 @@ files:
92
92
  - README.md
93
93
  - Rakefile
94
94
  - app/controllers/extended_wiki_controller.rb
95
+ - app/helpers/chili_pdf_helper.rb
95
96
  - app/views/extended_wiki/show.pdf.html.erb
96
97
  - app/views/layouts/pdf.pdf.erb
97
98
  - assets/stylesheets/pdf.css
metadata.gz.sig CHANGED
Binary file