Links in Published Webs
Links in the 'show' action should be to the 'show' action. Links in the 'published' action should be to the 'published' action. Try to focus, Distler!
This commit is contained in:
parent
1cdf0536c1
commit
43aadecc99
|
@ -85,14 +85,22 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
end
|
||||
when :publish
|
||||
if known_page
|
||||
web = Web.find_by_address(web_address)
|
||||
action = web.published? ? 'published' : 'show'
|
||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => action,
|
||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'published',
|
||||
:id => name
|
||||
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
||||
else
|
||||
%{<span class="newWikiWord">#{text}</span>}
|
||||
end
|
||||
when :show
|
||||
if known_page
|
||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'show',
|
||||
:id => name
|
||||
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
||||
else
|
||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'new',
|
||||
:id => name
|
||||
%{<span class="newWikiWord">#{text}<a href="#{href}">?</a></span>}
|
||||
end
|
||||
else
|
||||
if known_page
|
||||
web = Web.find_by_address(web_address)
|
||||
|
|
|
@ -319,6 +319,13 @@ class WikiControllerTest < Test::Unit::TestCase
|
|||
|
||||
assert_response(:success)
|
||||
assert_equal @home, r.template_objects['page']
|
||||
assert_match /<a class='existingWikiWord' href='http:\/\/test.host\/wiki1\/published\/ThatWay'>That Way<\/a>/, r.body
|
||||
|
||||
r = process('show', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||
|
||||
assert_response(:success)
|
||||
assert_equal @home, r.template_objects['page']
|
||||
assert_match /<a class='existingWikiWord' href='http:\/\/test.host\/wiki1\/show\/ThatWay'>That Way<\/a>/, r.body
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue