app/controllers/admin_controller.rb in instiki-0.10.1 vs app/controllers/admin_controller.rb in instiki-0.10.2
- old
+ new
@@ -4,23 +4,21 @@
layout 'default'
def create_system
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/>
- (WARNING: this will destroy content of your current wiki).
- EOL
+ flash[:error] =
+ "Wiki has already been created in '#{@wiki.storage_path}'. " +
+ "Shut down Instiki and delete this directory if you want to recreate it from scratch." +
+ "\n\n" +
+ "(WARNING: this will destroy content of your current wiki)."
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'])
- flash[:info] = <<-EOL
- Your new wiki '#{@params['web_name']}' is created!<br/>
- Please edit its home page and press Submit when finished.
- EOL
+ flash[:info] = "Your new wiki '#{@params['web_name']}' is created!\n" +
+ "Please edit its home page and press Submit when finished."
redirect_to :web => @params['web_address'], :controller => 'wiki', :action => 'new',
:id => 'HomePage'
else
# no form submitted -> go to template
end
@@ -34,11 +32,11 @@
@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
+ @error = e.message
# and re-render the form again
end
else
redirect_to :controller => 'wiki', :action => 'index'
end
@@ -46,10 +44,11 @@
# no form submitted -> render template
end
end
def edit_web
+
system_password = @params['system_password']
if system_password
# form submitted
if wiki.authenticate(system_password)
begin
@@ -66,15 +65,15 @@
@params['max_upload_size']
)
flash[:info] = "Web '#{@params['address']}' was successfully updated"
redirect_home(@params['address'])
rescue Instiki::ValidationError => e
- flash[:error] = e.message
+ @error = e.message
# and re-render the same template again
end
else
- flash[:error] = password_error(system_password)
+ @error = password_error(system_password)
# and re-render the same template again
end
else
# no form submitted - go to template
end
@@ -84,11 +83,11 @@
if wiki.authenticate(@params['system_password_orphaned'])
wiki.remove_orphaned_pages(@web_name)
flash[:info] = 'Orphaned pages removed'
redirect_to :controller => 'wiki', :web => @web_name, :action => 'list'
else
- flash[:error] = password_error(@params['system_password'])
- return_to_last_remembered
+ flash[:error] = password_error(@params['system_password_orphaned'])
+ redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web'
end
end
end