From: Tom Hughes Date: Sun, 1 Nov 2009 12:32:31 +0000 (+0000) Subject: We don't need the @notice hack - we can use flash.now to achieve the same thing. X-Git-Tag: live~6534 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/2541ad0f099a934b8ad3c2bdc085c89919407fa0 We don't need the @notice hack - we can use flash.now to achieve the same thing. --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e36c9842b..ed007cad3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base redirect_to params.merge(:cookie_test => "true") return false else - @notice = t 'application.require_cookies.cookies_needed' + flash.now[:notice] = t 'application.require_cookies.cookies_needed' end end end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index df6ca164c..3a65cea0a 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -101,9 +101,9 @@ class UserController < ApplicationController if user token = user.tokens.create Notifier.deliver_lost_password(user, token) - @notice = t 'user.lost_password.notice email on way' + flash.now[:notice] = t 'user.lost_password.notice email on way' else - @notice = t 'user.lost_password.notice email cannot find' + flash.now[:notice] = t 'user.lost_password.notice email cannot find' end end end @@ -152,9 +152,9 @@ class UserController < ApplicationController if user session[:user] = user.id elsif User.authenticate(:username => email_or_display_name, :password => pass, :inactive => true) - @notice = t 'user.login.account not active' + flash.now[:notice] = t 'user.login.account not active' else - @notice = t 'user.login.auth failure' + flash.now[:notice] = t 'user.login.auth failure' end end @@ -211,7 +211,7 @@ class UserController < ApplicationController redirect_to :action => 'account', :display_name => @user.display_name end else - @notice = t 'user.confirm.failure' + flash.now[:notice] = t 'user.confirm.failure' end end end @@ -231,7 +231,7 @@ class UserController < ApplicationController session[:user] = @user.id redirect_to :action => 'account', :display_name => @user.display_name else - @notice = t 'user.confirm_email.failure' + flash.now[:notice] = t 'user.confirm_email.failure' end end end diff --git a/app/views/layouts/site.html.erb b/app/views/layouts/site.html.erb index 89b33ab05..34738f73b 100644 --- a/app/views/layouts/site.html.erb +++ b/app/views/layouts/site.html.erb @@ -18,8 +18,8 @@
- <% if @notice || flash[:notice] %> -
<%= @notice || flash[:notice] %>
+ <% if flash[:notice] %> +
<%= flash[:notice] %>
<% end %> <%= yield %>