diff --git a/app/controllers/cache_sweeping_helper.rb b/app/controllers/cache_sweeping_helper.rb
index 74a0c065..c7109e19 100644
--- a/app/controllers/cache_sweeping_helper.rb
+++ b/app/controllers/cache_sweeping_helper.rb
@@ -32,6 +32,8 @@ module CacheSweepingHelper
:action => 'revision', :id => page.name, :rev => revno
expire_action :controller => 'wiki', :web => page.web.address,
: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
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 8c0672b1..878c0811 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -401,7 +401,7 @@ EOL
end
def source
- #to template
+ @revision = @page.revisions[params['rev'].to_i - 1] if params['rev']
end
def tex
diff --git a/app/views/wiki/revision.rhtml b/app/views/wiki/revision.rhtml
index 78a38f5b..abb0f184 100644
--- a/app/views/wiki/revision.rhtml
+++ b/app/views/wiki/revision.rhtml
@@ -22,5 +22,10 @@
diff --git a/app/views/wiki/source.html.erb b/app/views/wiki/source.html.erb
index 952cf56a..bb2efaf8 100644
--- a/app/views/wiki/source.html.erb
+++ b/app/views/wiki/source.html.erb
@@ -57,7 +57,7 @@ window.onload = function (){
-
+
diff --git a/config/routes.rb b/config/routes.rb
index 3925b009..d0a7ae5b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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',
: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/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}
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index c02269f3..6997a309 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -341,6 +341,13 @@ class WikiControllerTest < ActionController::TestCase
%{hat SmartEngineGUI})), r.body
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
set_web_property :published, true