working fine [Rails 2.3] but redirected page displayed inside the Shadowbox window

2 messages Options
Embed this post
Permalink
Kadoudal

working fine [Rails 2.3] but redirected page displayed inside the Shadowbox window

Reply Threaded More More options
Print post
Permalink
Hi all

I am new to Shadowbox, but I could make it run easily in my Rails app
I use it  for user registration
when user is not valid , messages are correctly displayed
my unique pending problem is when user is valid and I want to redirect to the home page

I use the following rjs file

if @user[:id].nil?
  page.replace_html  'inscription-box', :partial => 'register_form'
  page[:new_user].reset
else
  page.redirect_to root_url  
end


in this case, the Shadowbox is NOT closed and the home page is displayed INSIDE the Shadowbox
what could be wrong ?

thanks for your help

erwin
Kadoudal

Re: working fine [Rails 2.3] but redirected page displayed inside the Shadowbox window

Reply Threaded More More options
Print post
Permalink
I reply to myself ...

in the rjs file I wrote

  page << "window.parent.Shadowbox.close();"
  page << "window.parent.document.location.href = '#{root_url}'"


this close the Shadowbox window and redirect to the home page
cannot use the standard
   page.redirect_to root_url

need more study to understand why...    but it runs