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

This commit is contained in:
Jacques Distler 2011-08-27 22:01:07 -05:00
commit 9e25ada5c8
6 changed files with 17 additions and 2 deletions

View file

@ -32,6 +32,8 @@ module CacheSweepingHelper
:action => 'revision', :id => page.name, :rev => revno :action => 'revision', :id => page.name, :rev => revno
expire_action :controller => 'wiki', :web => page.web.address, expire_action :controller => 'wiki', :web => page.web.address,
:action => 'revision', :id => page.name, :rev => revno, :mode => 'diff' :action => 'revision', :id => page.name, :rev => revno, :mode => 'diff'
expire_action :controller => 'wiki', :web => page.web.address,
:action => 'source', :id => page.name, :rev => revno
end end
end end

View file

@ -401,7 +401,7 @@ EOL
end end
def source def source
#to template @revision = @page.revisions[params['rev'].to_i - 1] if params['rev']
end end
def tex def tex

View file

@ -22,5 +22,10 @@
<div class="navigation navfoot"> <div class="navigation navfoot">
<%= raw navigation_menu_for_revision.join(' | ') %> <%= raw navigation_menu_for_revision.join(' | ') %>
<span class="views">
| View:
<%= link_to 'Source', {:web => @web.address, :action => 'source', :id => @page.name, :rev => @revision_number},
{:id => 'view_source', :rel => 'nofollow' } %>
</span>
<%= render :partial => 'inbound_links' %> <%= render :partial => 'inbound_links' %>
</div> </div>

View file

@ -57,7 +57,7 @@ window.onload = function (){
<body> <body>
<div id="Container"> <div id="Container">
<textarea id='content' readonly=' readonly' rows='24' cols='60' ><%= h(@page.content.purify) %></textarea> <textarea id='content' readonly=' readonly' rows='24' cols='60' ><%= (@revision ? @revision.content : @page.content).purify %></textarea>
</div> <!-- Container --> </div> <!-- Container -->
</body> </body>

View file

@ -32,6 +32,7 @@ ActionController::Routing::Routes.draw do |map|
connect_to_web map, ':web/revision/diff/:id/:rev', :controller => 'wiki', :action => 'revision', :mode => 'diff', connect_to_web map, ':web/revision/diff/:id/:rev', :controller => 'wiki', :action => 'revision', :mode => 'diff',
:requirements => { :rev => /\d+/, :id => id_regexp} :requirements => { :rev => /\d+/, :id => id_regexp}
connect_to_web map, ':web/revision/:id/:rev', :controller => 'wiki', :action => 'revision', :requirements => { :rev => /\d+/, :id => id_regexp} connect_to_web map, ':web/revision/:id/:rev', :controller => 'wiki', :action => 'revision', :requirements => { :rev => /\d+/, :id => id_regexp}
connect_to_web map, ':web/source/:id/:rev', :controller => 'wiki', :action => 'source', :requirements => { :rev => /\d+/, :id => id_regexp}
connect_to_web map, ':web/list/:category', :controller => 'wiki', :action => 'list', :requirements => { :category => /.*/}, :category => nil connect_to_web map, ':web/list/:category', :controller => 'wiki', :action => 'list', :requirements => { :category => /.*/}, :category => nil
connect_to_web map, ':web/recently_revised/:category', :controller => 'wiki', :action => 'recently_revised', :requirements => { :category => /.*/}, :category => nil connect_to_web map, ':web/recently_revised/:category', :controller => 'wiki', :action => 'recently_revised', :requirements => { :category => /.*/}, :category => nil
connect_to_web map, ':web/:action/:id', :controller => 'wiki', :requirements => {:id => id_regexp} connect_to_web map, ':web/:action/:id', :controller => 'wiki', :requirements => {:id => id_regexp}

View file

@ -341,6 +341,13 @@ class WikiControllerTest < ActionController::TestCase
%{hat SmartEngineGUI})), r.body %{hat SmartEngineGUI})), r.body
end end
def test_source_with_revision
r = process('source', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '1')
assert_response(:success)
assert_match Regexp.new(Regexp.escape(%{First revision of the HomePage})), r.body
end
def test_published def test_published
set_web_property :published, true set_web_property :published, true