author links on print page are smart about whether they are being exported or just displayed in the browser
This commit is contained in:
parent
c99d675780
commit
5ea3f93bf9
|
@ -44,7 +44,11 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def export_html
|
def export_html
|
||||||
export_pages_as_zip('html') { |page| @page = page; render_to_string 'wiki/print' }
|
export_pages_as_zip('html') do |page|
|
||||||
|
@page = page
|
||||||
|
@link_mode = :export
|
||||||
|
render_to_string 'wiki/print'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def export_markup
|
def export_markup
|
||||||
|
@ -149,6 +153,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def print
|
def print
|
||||||
|
@link_mode ||= :show
|
||||||
# to template
|
# to template
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
<div class="byline">
|
<div class="byline">
|
||||||
<%= @page.revisions? ? "Revised" : "Created" %> on <%= @page.pretty_created_at %>
|
<%= @page.revisions? ? "Revised" : "Created" %> on <%= @page.pretty_created_at %>
|
||||||
by
|
by
|
||||||
<%= @page.author_link({ :mode => :export }) %>
|
<%= @page.author_link({ :mode => (@link_mode || :show) }) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -102,6 +102,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
r.headers['Content-Disposition']
|
r.headers['Content-Disposition']
|
||||||
content = r.binary_content
|
content = r.binary_content
|
||||||
assert_equal 'PK', content[0..1], 'Content is not a zip file'
|
assert_equal 'PK', content[0..1], 'Content is not a zip file'
|
||||||
|
assert_equal :export, r.template_objects['link_mode']
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_export_markup
|
def test_export_markup
|
||||||
|
@ -233,8 +234,10 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
|
||||||
def test_print
|
def test_print
|
||||||
process('print', 'web' => 'wiki1', 'id' => 'HomePage')
|
r = process('print', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
|
assert_equal :show, r.template_objects['link_mode']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue