##// END OF EJS Templates
pdf: add a new feature to export wiki pdf (#401)...
Toshi MARUYAMA -
r7621:00faf35e05eb
parent child
Show More
@@ -40,6 +40,7 class WikiController < ApplicationController
40 helper :attachments
40 helper :attachments
41 include AttachmentsHelper
41 include AttachmentsHelper
42 helper :watchers
42 helper :watchers
43 include Redmine::Export::PDF
43
44
44 # List of pages, sorted alphabetically and by parent (hierarchy)
45 # List of pages, sorted alphabetically and by parent (hierarchy)
45 def index
46 def index
@@ -71,7 +72,10 class WikiController < ApplicationController
71 end
72 end
72 @content = @page.content_for_version(params[:version])
73 @content = @page.content_for_version(params[:version])
73 if User.current.allowed_to?(:export_wiki_pages, @project)
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 export = render_to_string :action => 'export', :layout => false
79 export = render_to_string :action => 'export', :layout => false
76 send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
80 send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
77 return
81 return
@@ -53,6 +53,7
53 <% end %>
53 <% end %>
54
54
55 <% other_formats_links do |f| %>
55 <% other_formats_links do |f| %>
56 <%= f.link_to 'PDF', :url => {:id => @page.title, :version => @content.version} %>
56 <%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %>
57 <%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %>
57 <%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %>
58 <%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %>
58 <% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
59 <% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
General Comments 0
You need to be logged in to leave comments. Login now