Merged new_web action into create_web

This commit is contained in:
Alexey Verkhovsky 2005-01-28 03:44:36 +00:00
parent 16dcdb6e0e
commit 63cf09059b
5 changed files with 27 additions and 26 deletions

View file

@ -5,7 +5,7 @@ class AdminController < ApplicationController
layout 'default'
def create_system
if wiki.setup?
if @wiki.setup?
flash[:error] = <<-EOL
Wiki has already been created in '#{@wiki.storage_path}'. Shut down Instiki and delete
this directory if you want to recreate it from scratch.<br/><br/>
@ -27,11 +27,19 @@ class AdminController < ApplicationController
end
def create_web
if @wiki.authenticate(@params['system_password'])
@wiki.create_web(@params['name'], @params['address'])
redirect_show('HomePage', @params['address'])
else
redirect_to :action => 'index'
if @params['address']
# form submitted
if @wiki.authenticate(@params['system_password'])
@wiki.create_web(@params['name'], @params['address'])
redirect_show('HomePage', @params['address'])
else
redirect_to :action => 'index'
end
else
# no form submitted -> render template
if @wiki.system[:password].nil?
redirect_to :controller => 'wiki', :action => 'index'
end
end
end
@ -39,11 +47,6 @@ class AdminController < ApplicationController
# to template
end
def new_web
redirect_to :action => 'index' if wiki.system['password'].nil?
# otherwise, to template
end
def update_web
if wiki.authenticate(@params['system_password'])
wiki.update_web(