Project

General

Profile

Feature #401 » wiki_pdf_export_app.patch

Jun NAITOH, 2011-10-30 02:35

View differences:

app/controllers/wiki_controller.rb (working copy)
40 40
  helper :attachments
41 41
  include AttachmentsHelper
42 42
  helper :watchers
43
  include Redmine::Export::PDF
43 44

  
44 45
  # List of pages, sorted alphabetically and by parent (hierarchy)
45 46
  def index
......
71 72
    end
72 73
    @content = @page.content_for_version(params[:version])
73 74
    if User.current.allowed_to?(:export_wiki_pages, @project)
74
      if params[:format] == 'html'
75
      if params[:format] == 'pdf'
76
        send_data(wiki_to_pdf(@page, @project), :type => 'application/pdf', :filename => "#{@page.title}.pdf")
77
        return
78
      elsif params[:format] == 'html'
75 79
        export = render_to_string :action => 'export', :layout => false
76 80
        send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
77 81
        return
app/views/wiki/show.html.erb (working copy)
53 53
<% end %>
54 54

  
55 55
<% other_formats_links do |f| %>
56
  <%= f.link_to 'PDF', :url => {:id => @page.title, :version => @content.version} %>
56 57
  <%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %>
57 58
  <%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %>
58 59
<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
(1-1/3)