Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
9edb8f6045
|
@ -250,6 +250,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def rollback
|
def rollback
|
||||||
get_page_and_revision
|
get_page_and_revision
|
||||||
|
@page.lock(Time.now, @author)
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
|
|
|
@ -70,14 +70,14 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
when :publish
|
when :publish
|
||||||
if known_file
|
if known_file
|
||||||
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
||||||
:id => name
|
:id => name, :only_path => true
|
||||||
%{<a class="existingWikiWord" title="#{description}" href="#{href}">#{text}</a>}
|
%{<a class="existingWikiWord" title="#{description}" href="#{href}">#{text}</a>}
|
||||||
else
|
else
|
||||||
%{<span class="newWikiWord">#{text}</span>}
|
%{<span class="newWikiWord">#{text}</span>}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
||||||
:id => name
|
:id => name, :only_path => true
|
||||||
if known_file
|
if known_file
|
||||||
%{<a class="existingWikiWord" title="#{description}" href="#{href}">#{text}</a>}
|
%{<a class="existingWikiWord" title="#{description}" href="#{href}">#{text}</a>}
|
||||||
else
|
else
|
||||||
|
@ -98,7 +98,7 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
when :publish
|
when :publish
|
||||||
if known_page
|
if known_page
|
||||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'published',
|
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>}
|
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
||||||
else
|
else
|
||||||
%{<span class="newWikiWord">#{text}</span>}
|
%{<span class="newWikiWord">#{text}</span>}
|
||||||
|
@ -106,11 +106,11 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
when :show
|
when :show
|
||||||
if known_page
|
if known_page
|
||||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'show',
|
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>}
|
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
||||||
else
|
else
|
||||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'new',
|
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>}
|
%{<span class="newWikiWord">#{text}<a href="#{href}">?</a></span>}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -118,11 +118,11 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
web = Web.find_by_address(web_address)
|
web = Web.find_by_address(web_address)
|
||||||
action = web.published? ? 'published' : 'show'
|
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 => action,
|
||||||
:id => name
|
:id => name, :only_path => true
|
||||||
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
||||||
else
|
else
|
||||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'new',
|
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>}
|
%{<span class="newWikiWord">#{text}<a href="#{href}">?</a></span>}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -130,7 +130,7 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
|
|
||||||
def pic_link(mode, name, text, web_address, known_pic)
|
def pic_link(mode, name, text, web_address, known_pic)
|
||||||
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
||||||
:id => name
|
:id => name, :only_path => true
|
||||||
case mode
|
case mode
|
||||||
when :export
|
when :export
|
||||||
if known_pic
|
if known_pic
|
||||||
|
@ -155,7 +155,7 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
|
|
||||||
def media_link(mode, name, text, web_address, known_media, media_type)
|
def media_link(mode, name, text, web_address, known_media, media_type)
|
||||||
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
||||||
:id => name
|
:id => name, :only_path => true
|
||||||
case mode
|
case mode
|
||||||
when :export
|
when :export
|
||||||
if known_media
|
if known_media
|
||||||
|
@ -180,7 +180,7 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
|
|
||||||
def delete_link(mode, name, web_address, known_file)
|
def delete_link(mode, name, web_address, known_file)
|
||||||
href = @controller.url_for :controller => 'file', :web => web_address,
|
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
|
if mode == :show and known_file
|
||||||
%{<span class="deleteWikiWord"><a href="#{href}">Delete #{name}</a></span>}
|
%{<span class="deleteWikiWord"><a href="#{href}">Delete #{name}</a></span>}
|
||||||
else
|
else
|
||||||
|
|
|
@ -322,13 +322,13 @@ class WikiControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
assert_response(:success)
|
assert_response(:success)
|
||||||
assert_equal @home, r.template_objects['page']
|
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')
|
r = process('show', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
|
|
||||||
assert_response(:success)
|
assert_response(:success)
|
||||||
assert_equal @home, r.template_objects['page']
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -864,7 +864,7 @@ class WikiControllerTest < ActionController::TestCase
|
||||||
r = process('show', 'id' => 'HomePage', 'web' => 'wiki1')
|
r = process('show', 'id' => 'HomePage', 'web' => 'wiki1')
|
||||||
|
|
||||||
assert_response :success
|
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
|
end
|
||||||
|
|
||||||
def test_show_page_nonexistant_page
|
def test_show_page_nonexistant_page
|
||||||
|
|
Loading…
Reference in a new issue