More user-friendly error handling in admin/create_web
This commit is contained in:
parent
d330c02186
commit
b333e0797c
|
@ -19,7 +19,7 @@ class AdminController < ApplicationController
|
||||||
Your new wiki '#{@params['web_name']}' is created!<br/>
|
Your new wiki '#{@params['web_name']}' is created!<br/>
|
||||||
Please edit its home page and press Submit when finished.
|
Please edit its home page and press Submit when finished.
|
||||||
EOL
|
EOL
|
||||||
redirect_to :web => @params['web_address'], :controller => 'wiki', :action => 'new',
|
redirect_to :web => @params['web_address'], :controller => 'wiki', :action => 'new',
|
||||||
:id => 'HomePage'
|
:id => 'HomePage'
|
||||||
else
|
else
|
||||||
# no form submitted -> go to template
|
# no form submitted -> go to template
|
||||||
|
@ -30,8 +30,14 @@ class AdminController < ApplicationController
|
||||||
if @params['address']
|
if @params['address']
|
||||||
# form submitted
|
# form submitted
|
||||||
if @wiki.authenticate(@params['system_password'])
|
if @wiki.authenticate(@params['system_password'])
|
||||||
@wiki.create_web(@params['name'], @params['address'])
|
begin
|
||||||
redirect_show('HomePage', @params['address'])
|
@wiki.create_web(@params['name'], @params['address'])
|
||||||
|
flash[:info] = "New web '#{@params['name']}' successfully created."
|
||||||
|
redirect_to :web => @params['address'], :controller => 'wiki', :action => 'new',
|
||||||
|
:id => 'HomePage'
|
||||||
|
rescue Instiki::ValidationError => e
|
||||||
|
flash[:error] = e.message
|
||||||
|
end
|
||||||
else
|
else
|
||||||
redirect_to :controller => 'wiki', :action => 'index'
|
redirect_to :controller => 'wiki', :action => 'index'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue