Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2009-07-27 22:53:11 -05:00
commit 9edb8f6045
3 changed files with 15 additions and 14 deletions

View file

@ -250,6 +250,7 @@ class WikiController < ApplicationController
def rollback
get_page_and_revision
@page.lock(Time.now, @author)
end
def save

View file

@ -69,15 +69,15 @@ class UrlGenerator < AbstractUrlGenerator
end
when :publish
if known_file
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
:id => name
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
:id => name, :only_path => true
%{<a class="existingWikiWord" title="#{description}" href="#{href}">#{text}</a>}
else
%{<span class="newWikiWord">#{text}</span>}
end
else
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
:id => name
:id => name, :only_path => true
if known_file
%{<a class="existingWikiWord" title="#{description}" href="#{href}">#{text}</a>}
else
@ -98,7 +98,7 @@ class UrlGenerator < AbstractUrlGenerator
when :publish
if known_page
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'published',
:id => name
:id => name, :only_path => true
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
else
%{<span class="newWikiWord">#{text}</span>}
@ -106,11 +106,11 @@ class UrlGenerator < AbstractUrlGenerator
when :show
if known_page
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'show',
:id => name
:id => name, :only_path => true
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
else
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'new',
:id => name
:id => name, :only_path => true
%{<span class="newWikiWord">#{text}<a href="#{href}">?</a></span>}
end
else
@ -118,11 +118,11 @@ class UrlGenerator < AbstractUrlGenerator
web = Web.find_by_address(web_address)
action = web.published? ? 'published' : 'show'
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => action,
:id => name
:id => name, :only_path => true
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
else
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'new',
:id => name
:id => name, :only_path => true
%{<span class="newWikiWord">#{text}<a href="#{href}">?</a></span>}
end
end
@ -130,7 +130,7 @@ class UrlGenerator < AbstractUrlGenerator
def pic_link(mode, name, text, web_address, known_pic)
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
:id => name
:id => name, :only_path => true
case mode
when :export
if known_pic
@ -155,7 +155,7 @@ class UrlGenerator < AbstractUrlGenerator
def media_link(mode, name, text, web_address, known_media, media_type)
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
:id => name
:id => name, :only_path => true
case mode
when :export
if known_media
@ -180,7 +180,7 @@ class UrlGenerator < AbstractUrlGenerator
def delete_link(mode, name, web_address, known_file)
href = @controller.url_for :controller => 'file', :web => web_address,
:action => 'delete', :id => name
:action => 'delete', :id => name, :only_oath => true
if mode == :show and known_file
%{<span class="deleteWikiWord"><a href="#{href}">Delete #{name}</a></span>}
else

View file

@ -322,13 +322,13 @@ class WikiControllerTest < ActionController::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
assert_match /<a class='existingWikiWord' href='\/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
assert_match /<a class='existingWikiWord' href='\/wiki1\/show\/ThatWay'>That Way<\/a>/, r.body
end
@ -864,7 +864,7 @@ class WikiControllerTest < ActionController::TestCase
r = process('show', 'id' => 'HomePage', 'web' => 'wiki1')
assert_response :success
assert_match /<p>Nonrecursive-include:<\/p>\n\n<p>extra fun<\/p>\n\n<p><a class='existingWikiWord' href='http:\/\/test.host\/wiki1\/show\/HomePage'>HomePage<\/a><\/p>/, r.body
assert_match /<p>Nonrecursive-include:<\/p>\n\n<p>extra fun<\/p>\n\n<p><a class='existingWikiWord' href='\/wiki1\/show\/HomePage'>HomePage<\/a><\/p>/, r.body
end
def test_show_page_nonexistant_page