Renamed redirect_show to redirect_to_page and redirect_home
This commit is contained in:
parent
396c651487
commit
24f418e5b5
|
@ -11,7 +11,7 @@ class AdminController < ApplicationController
|
||||||
this directory if you want to recreate it from scratch.<br/><br/>
|
this directory if you want to recreate it from scratch.<br/><br/>
|
||||||
(WARNING: this will destroy content of your current wiki).
|
(WARNING: this will destroy content of your current wiki).
|
||||||
EOL
|
EOL
|
||||||
redirect_show('HomePage', @wiki.webs.keys.first)
|
redirect_home(@wiki.webs.keys.first)
|
||||||
elsif @params['web_name']
|
elsif @params['web_name']
|
||||||
# form submitted -> create a wiki
|
# form submitted -> create a wiki
|
||||||
@wiki.setup(@params['password'], @params['web_name'], @params['web_address'])
|
@wiki.setup(@params['password'], @params['web_name'], @params['web_address'])
|
||||||
|
@ -66,7 +66,7 @@ class AdminController < ApplicationController
|
||||||
@params['max_upload_size']
|
@params['max_upload_size']
|
||||||
)
|
)
|
||||||
flash[:info] = "Web '#{@params['address']}' was successfully updated"
|
flash[:info] = "Web '#{@params['address']}' was successfully updated"
|
||||||
redirect_show('HomePage', @params['address'])
|
redirect_home(@params['address'])
|
||||||
rescue Instiki::ValidationError => e
|
rescue Instiki::ValidationError => e
|
||||||
flash[:error] = e.message
|
flash[:error] = e.message
|
||||||
# and re-render the same template again
|
# and re-render the same template again
|
||||||
|
|
|
@ -87,7 +87,11 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
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',
|
redirect_to :web => web, :controller => 'wiki', :action => 'show',
|
||||||
:id => (page_name || 'HomePage')
|
:id => (page_name || 'HomePage')
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,11 +9,11 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if @web_name
|
if @web_name
|
||||||
redirect_show 'HomePage'
|
redirect_home
|
||||||
elsif not @wiki.setup?
|
elsif not @wiki.setup?
|
||||||
redirect_to :controller => 'admin', :action => 'create_system'
|
redirect_to :controller => 'admin', :action => 'create_system'
|
||||||
elsif @wiki.webs.length == 1
|
elsif @wiki.webs.length == 1
|
||||||
redirect_show 'HomePage', @wiki.webs.values.first.address
|
redirect_home @wiki.webs.values.first.address
|
||||||
else
|
else
|
||||||
redirect_to :action => 'web_list'
|
redirect_to :action => 'web_list'
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def authenticate
|
def authenticate
|
||||||
if password_check(@params['password'])
|
if password_check(@params['password'])
|
||||||
redirect_show('HomePage')
|
redirect_home
|
||||||
else
|
else
|
||||||
flash[:info] = password_error(@params['password'])
|
flash[:info] = password_error(@params['password'])
|
||||||
redirect_to :action => 'login', :web => @web_name
|
redirect_to :action => 'login', :web => @web_name
|
||||||
|
@ -109,7 +109,7 @@ class WikiController < ApplicationController
|
||||||
@results = @web.select { |page| page.content =~ /#{@query}/i }.sort
|
@results = @web.select { |page| page.content =~ /#{@query}/i }.sort
|
||||||
all_pages_found = (@results + @title_results).uniq
|
all_pages_found = (@results + @title_results).uniq
|
||||||
if all_pages_found.size == 1
|
if all_pages_found.size == 1
|
||||||
redirect_show(all_pages_found.first.name)
|
redirect_to_page(all_pages_found.first.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def cancel_edit
|
def cancel_edit
|
||||||
@page.unlock
|
@page.unlock
|
||||||
redirect_show
|
redirect_to_page(@page_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
@ -159,7 +159,7 @@ class WikiController < ApplicationController
|
||||||
if @web.published
|
if @web.published
|
||||||
@page = wiki.read_page(@web_name, @page_name || 'HomePage')
|
@page = wiki.read_page(@web_name, @page_name || 'HomePage')
|
||||||
else
|
else
|
||||||
redirect_show('HomePage')
|
redirect_home
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class WikiController < ApplicationController
|
||||||
Author.new(@params['author'], remote_ip)
|
Author.new(@params['author'], remote_ip)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
redirect_show(@page_name)
|
redirect_to_page @page_name
|
||||||
rescue Instiki::ValidationError => e
|
rescue Instiki::ValidationError => e
|
||||||
page.unlock if defined? page
|
page.unlock if defined? page
|
||||||
flash[:error] = e
|
flash[:error] = e
|
||||||
|
|
Loading…
Reference in a new issue