diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index c7ca2216..9b503bd9 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -36,7 +36,7 @@ class AdminController < ApplicationController 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 @@ -48,6 +48,7 @@ class AdminController < ApplicationController end def edit_web + system_password = @params['system_password'] if system_password # form submitted @@ -68,11 +69,11 @@ class AdminController < ApplicationController 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 diff --git a/app/controllers/file_controller.rb b/app/controllers/file_controller.rb index 05e87329..bf0ee964 100644 --- a/app/controllers/file_controller.rb +++ b/app/controllers/file_controller.rb @@ -36,8 +36,8 @@ class FileController < ApplicationController if @params['file'] # form supplied file_yard.upload_file(@file_name, @params['file']) - flash[:info] = "Image '#{@file_name}' successfully uploaded" @web.refresh_pages_with_references(@file_name) + flash[:info] = "Image '#{@file_name}' successfully uploaded" return_to_last_remembered elsif file_yard.has_file?(@file_name) send_file(file_yard.file_path(@file_name)) @@ -59,7 +59,7 @@ class FileController < ApplicationController if @problems.empty? flash[:info] = 'Import successfully finished' else - flash[:info] = "Import finished, but some pages were not imported:
  • " + + flash[:error] = "Import finished, but some pages were not imported:
  • " + @problems.join('
  • ') + '
  • ' end return_to_last_remembered diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 42202b54..57055369 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -46,6 +46,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +

    @@ -59,8 +60,8 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <% end %>

    -<% if @flash[:error] %>
    -

    <%= @flash[:error].to_s %>


    +<% if @error or @flash[:error] %>
    +

    <%= (@error || @flash[:error]) %>


    <% end %> <% if @flash[:info] %>
    diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb index 185bc301..011917aa 100644 --- a/test/functional/admin_controller_test.rb +++ b/test/functional/admin_controller_test.rb @@ -155,7 +155,7 @@ class AdminControllerTest < Test::Unit::TestCase #returns to the same form assert_success - assert_flash_has :error + assert @response.has_template_object?(:error) end def test_edit_web_rename_to_already_existing_web_name @@ -169,7 +169,7 @@ class AdminControllerTest < Test::Unit::TestCase #returns to the same form assert_success - assert_flash_has :error + assert @response.has_template_object?(:error) end def test_edit_web_empty_password @@ -180,7 +180,7 @@ class AdminControllerTest < Test::Unit::TestCase #returns to the same form assert_success - assert_flash_has :error + assert @response.has_template_object?(:error) end