diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 0aaa9486..c7ca2216 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -11,7 +11,7 @@ class AdminController < ApplicationController
this directory if you want to recreate it from scratch.
(WARNING: this will destroy content of your current wiki).
EOL
- redirect_show('HomePage', @wiki.webs.keys.first)
+ redirect_home(@wiki.webs.keys.first)
elsif @params['web_name']
# form submitted -> create a wiki
@wiki.setup(@params['password'], @params['web_name'], @params['web_address'])
@@ -66,7 +66,7 @@ class AdminController < ApplicationController
@params['max_upload_size']
)
flash[:info] = "Web '#{@params['address']}' was successfully updated"
- redirect_show('HomePage', @params['address'])
+ redirect_home(@params['address'])
rescue Instiki::ValidationError => e
flash[:error] = e.message
# and re-render the same template again
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index c49b276d..fb0da1db 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -87,7 +87,11 @@ class ApplicationController < ActionController::Base
end
end
- def redirect_show(page_name = @page_name, web = @web_name)
+ def redirect_home(web = @web_name)
+ redirect_to_page('HomePage', web)
+ end
+
+ def redirect_to_page(page_name = @page_name, web = @web_name)
redirect_to :web => web, :controller => 'wiki', :action => 'show',
:id => (page_name || 'HomePage')
end
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 12f12d02..7f90369e 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -9,11 +9,11 @@ class WikiController < ApplicationController
def index
if @web_name
- redirect_show 'HomePage'
+ redirect_home
elsif not @wiki.setup?
redirect_to :controller => 'admin', :action => 'create_system'
elsif @wiki.webs.length == 1
- redirect_show 'HomePage', @wiki.webs.values.first.address
+ redirect_home @wiki.webs.values.first.address
else
redirect_to :action => 'web_list'
end
@@ -23,7 +23,7 @@ class WikiController < ApplicationController
def authenticate
if password_check(@params['password'])
- redirect_show('HomePage')
+ redirect_home
else
flash[:info] = password_error(@params['password'])
redirect_to :action => 'login', :web => @web_name
@@ -109,7 +109,7 @@ class WikiController < ApplicationController
@results = @web.select { |page| page.content =~ /#{@query}/i }.sort
all_pages_found = (@results + @title_results).uniq
if all_pages_found.size == 1
- redirect_show(all_pages_found.first.name)
+ redirect_to_page(all_pages_found.first.name)
end
end
@@ -117,7 +117,7 @@ class WikiController < ApplicationController
def cancel_edit
@page.unlock
- redirect_show
+ redirect_to_page(@page_name)
end
def edit
@@ -159,7 +159,7 @@ class WikiController < ApplicationController
if @web.published
@page = wiki.read_page(@web_name, @page_name || 'HomePage')
else
- redirect_show('HomePage')
+ redirect_home
end
end
@@ -189,7 +189,7 @@ class WikiController < ApplicationController
Author.new(@params['author'], remote_ip)
)
end
- redirect_show(@page_name)
+ redirect_to_page @page_name
rescue Instiki::ValidationError => e
page.unlock if defined? page
flash[:error] = e