From f3a7648d3946f25d0fc69b55404de5d5ea27470b Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 18 Jan 2008 18:27:20 +0000 Subject: [PATCH] ActionItem152: logging in and out with popups --- app/controllers/public/account_controller.rb | 8 ++++++++ app/views/account/logout_popup.rhtml | 6 ++++++ test/functional/account_controller_test.rb | 12 ++++++++++++ 3 files changed, 26 insertions(+), 0 deletions(-) create mode 100644 app/views/account/logout_popup.rhtml diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index e128bcc..31a6427 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -26,6 +26,14 @@ class AccountController < PublicController end end + def logout_popup + render :action => 'logout_popup', :layout => false + end + + def login_popup + render :action => 'login', :layout => false + end + # action to register an user to the application def signup begin diff --git a/app/views/account/logout_popup.rhtml b/app/views/account/logout_popup.rhtml new file mode 100644 index 0000000..5d1a92c --- /dev/null +++ b/app/views/account/logout_popup.rhtml @@ -0,0 +1,6 @@ +

<%= _('Are you sure?') %>

+ +<% button_bar do %> + <%= button :ok, _('Yes, I want to logout'), { :controller => 'account', :action => 'logout' } %> + <%= lightbox_close_button _('No, I want to stay logged in.') %> +<% end %> diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 985c736..7f56572 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -234,6 +234,18 @@ class AccountControllerTest < Test::Unit::TestCase assert !User.find(user.id).authenticated?('onepass') end + should 'display login popup' do + get :login_popup + assert_template 'login' + assert_no_tag :tag => "body" # e.g. no layout + end + + should 'display logout popup' do + get :logout_popup + assert_template 'logout_popup' + assert_no_tag :tag => "body" # e.g. no layout + end + protected def create_user(options = {}) post :signup, :user => { :login => 'quire', :email => 'quire@example.com', -- libgit2 0.21.2