Commit f3a7648d3946f25d0fc69b55404de5d5ea27470b

Authored by AntonioTerceiro
1 parent 7dcab529

ActionItem152: logging in and out with popups


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1212 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/account_controller.rb
@@ -26,6 +26,14 @@ class AccountController < PublicController @@ -26,6 +26,14 @@ class AccountController < PublicController
26 end 26 end
27 end 27 end
28 28
  29 + def logout_popup
  30 + render :action => 'logout_popup', :layout => false
  31 + end
  32 +
  33 + def login_popup
  34 + render :action => 'login', :layout => false
  35 + end
  36 +
29 # action to register an user to the application 37 # action to register an user to the application
30 def signup 38 def signup
31 begin 39 begin
app/views/account/logout_popup.rhtml 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +<p><%= _('Are you sure?') %></p>
  2 +
  3 +<% button_bar do %>
  4 + <%= button :ok, _('Yes, I want to logout'), { :controller => 'account', :action => 'logout' } %>
  5 + <%= lightbox_close_button _('No, I want to stay logged in.') %>
  6 +<% end %>
test/functional/account_controller_test.rb
@@ -234,6 +234,18 @@ class AccountControllerTest &lt; Test::Unit::TestCase @@ -234,6 +234,18 @@ class AccountControllerTest &lt; Test::Unit::TestCase
234 assert !User.find(user.id).authenticated?('onepass') 234 assert !User.find(user.id).authenticated?('onepass')
235 end 235 end
236 236
  237 + should 'display login popup' do
  238 + get :login_popup
  239 + assert_template 'login'
  240 + assert_no_tag :tag => "body" # e.g. no layout
  241 + end
  242 +
  243 + should 'display logout popup' do
  244 + get :logout_popup
  245 + assert_template 'logout_popup'
  246 + assert_no_tag :tag => "body" # e.g. no layout
  247 + end
  248 +
237 protected 249 protected
238 def create_user(options = {}) 250 def create_user(options = {})
239 post :signup, :user => { :login => 'quire', :email => 'quire@example.com', 251 post :signup, :user => { :login => 'quire', :email => 'quire@example.com',