ybernet-uAjRD0nVeow@public.gmane.org
2009-Apr-14 13:33 UTC
is it possible to render a modal dialog box from the server?
I have a before filter that authorizes a user''s credentials before giving them access to any protected methods (pretty standard practice). If they fail authorization, I want to direct them to a chance to login or to create an account (also pretty standard practice). Here''s the rub: I want to offer them a login form in a small modal box overlayed on their current screen. I know how to do this from the client side, using javascript, but in this case, I want the server to render that modal box (since it''s the server that determines that the user''s credentials are missing). Any ideas how to do this? Thanks, Yoram --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Brendon
2009-Apr-14 14:47 UTC
Re: is it possible to render a modal dialog box from the server?
The server can only respond to client (browser) requests, so you have to either render a login page and then redirect to the original destination or you need to have some javascript to help with what you want. In short, the server can''t MAKE the browser do anything... On Apr 14, 6:33 am, "yber...-uAjRD0nVeow@public.gmane.org" <yber...-uAjRD0nVeow@public.gmane.org> wrote:> I have a before filter that authorizes a user''s credentials before > giving them access to any protected methods (pretty standard > practice). If they fail authorization, I want to direct them to a > chance to login or to create an account (also pretty standard > practice). > > Here''s the rub: > I want to offer them a login form in a small modal box overlayed on > their current screen. I know how to do this from the client side, > using javascript, but in this case, I want the server to render that > modal box (since it''s the server that determines that the user''s > credentials are missing). > > Any ideas how to do this? > > Thanks, > Yoram--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
yoram
2009-Apr-14 15:42 UTC
Re: is it possible to render a modal dialog box from the server?
so you have> to either render a login pageyes but - can i render that login page as an overlay modal box instead of a full page? i suspect that the answer is not... thanks for your reply On Apr 14, 7:47 am, Brendon <bren...-gi94QSVkwfGt/hvpvFFPbQ@public.gmane.org> wrote:> The server can only respond to client (browser) requests, so you have > to either render a login page and then redirect to the original > destination or you need to have some javascript to help with what you > want. In short, the server can''t MAKE the browser do anything... > > On Apr 14, 6:33 am, "yber...-uAjRD0nVeow@public.gmane.org" <yber...-uAjRD0nVeow@public.gmane.org> wrote: > > > I have a before filter that authorizes a user''s credentials before > > giving them access to any protected methods (pretty standard > > practice). If they fail authorization, I want to direct them to a > > chance to login or to create an account (also pretty standard > > practice). > > > Here''s the rub: > > I want to offer them a login form in a small modal box overlayed on > > their current screen. I know how to do this from the client side, > > using javascript, but in this case, I want the server to render that > > modal box (since it''s the server that determines that the user''s > > credentials are missing). > > > Any ideas how to do this? > > > Thanks, > > Yoram--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Marnen Laibow-Koser
2009-Apr-14 16:28 UTC
Re: is it possible to render a modal dialog box from the server?
yoram wrote: [...]> yes but - can i render that login page as an overlay modal box instead > of a full page?[...] Sure, with appropriate JavaScript and a suitably constructed partial or other HTML file. (But remember to make it accessible also to users who don''t have JavaScript turned on.) Also see if HTTP-Basic authentication is suitable for your needs. With this model, the server tells the browser that it wants login credentials, and the browser presents a login dialog of some sort, so that the server doesn''t have to provide an HTML login form. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
bill walton
2009-Apr-16 13:49 UTC
Re: is it possible to render a modal dialog box from the server?
On Tue, 2009-04-14 at 08:42 -0700, yoram wrote:> yes but - can i render that login page as an overlay modal box instead > of a full page? i suspect > that the answer is not...Check out Craig Ambrose''s Redbox plugin. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---