pdf: add a new feature to export wiki pdf (#401)
Contributed by Jun NAITOH. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7741 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1713432ab0
commit
00faf35e05
@ -40,6 +40,7 @@ class WikiController < ApplicationController
|
|||||||
helper :attachments
|
helper :attachments
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
helper :watchers
|
helper :watchers
|
||||||
|
include Redmine::Export::PDF
|
||||||
|
|
||||||
# List of pages, sorted alphabetically and by parent (hierarchy)
|
# List of pages, sorted alphabetically and by parent (hierarchy)
|
||||||
def index
|
def index
|
||||||
@ -71,7 +72,10 @@ class WikiController < ApplicationController
|
|||||||
end
|
end
|
||||||
@content = @page.content_for_version(params[:version])
|
@content = @page.content_for_version(params[:version])
|
||||||
if User.current.allowed_to?(:export_wiki_pages, @project)
|
if User.current.allowed_to?(:export_wiki_pages, @project)
|
||||||
if params[:format] == 'html'
|
if params[:format] == 'pdf'
|
||||||
|
send_data(wiki_to_pdf(@page, @project), :type => 'application/pdf', :filename => "#{@page.title}.pdf")
|
||||||
|
return
|
||||||
|
elsif params[:format] == 'html'
|
||||||
export = render_to_string :action => 'export', :layout => false
|
export = render_to_string :action => 'export', :layout => false
|
||||||
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
|
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
|
||||||
return
|
return
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% other_formats_links do |f| %>
|
||||||
|
<%= f.link_to 'PDF', :url => {:id => @page.title, :version => @content.version} %>
|
||||||
<%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %>
|
<%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %>
|
||||||
<%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %>
|
<%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %>
|
||||||
<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user