Right now I have a login partial that expands so the user can login. After the user logins in I want that partial to go away. What is the recommended way of doing this?
on 2007-04-10 21:28
on 2007-04-10 22:00
You just need to check to see if they're logged in. Usually you'll have something in the session like this: <% unless session[:logged_in] %> <%=render :partial =>"login" %> <% end %> Something along those lines.
on 2007-04-10 22:11
Brian Hogan wrote: > You just need to check to see if they're logged in. Usually you'll have > something in the session like this: > > <% unless session[:logged_in] %> > <%=render :partial =>"login" %> > <% end %> > > Something along those lines. I didn't explain right. Go to say http://newsvine.com and try to login. When you select to login, an AJAX style element comes down to allow you to login. After you login, that element goes away. So if I render the partial "login" in the rjs template associated with my login action, how do I remove that template once they click the login button? Do I just redirect them back to the home page? That doesn't seem elegant as it requires refreshing the entire page.
on 2007-04-10 22:27
Ahhh. your login form would be a form_remote tag. Your controller that logs you in would render an rjs that does a page.remove"login_form_id" or whatever.
on 2007-04-10 22:29
Keep in mind also that when you do that, you force users to have JS-enabled browsers. In my opinion, an app should still work if JS is disabled or not available.