More user-friendly error handling in admin/create_web

This commit is contained in:
Alexey Verkhovsky 2005-03-26 00:09:41 +00:00
parent d330c02186
commit b333e0797c

View file

@ -30,8 +30,14 @@ class AdminController < ApplicationController
if @params['address']
# form submitted
if @wiki.authenticate(@params['system_password'])
begin
@wiki.create_web(@params['name'], @params['address'])
redirect_show('HomePage', @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
redirect_to :controller => 'wiki', :action => 'index'
end