Hello, I seem to be having a very hard time creating a login form that would sit in the sidebar or header of a website which can be used to login from ANY page. The problem is that the login form needs to be somehow ''included'' in the application ''global'' layout, but all the reference material places the "login" method as a separate view. How would I include the login as part of the layout? -- 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 -~----------~----~----~----~------~----~------~--~---
Steve, You reference a partial in your master layout file, application.rhtml which resides in views/layouts. You will need to include the path to the partial though. For example, if you have a login form in apps/views/sessions/ _form.rhtml then you could reference that in your application.rhtml file as: <%= render :partial => ''sessions/_form.html'' %> Cheers, Nicholas On Nov 16, 11:24 pm, Steve Oco <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello, > > I seem to be having a very hard time creating a login form that would > sit in the sidebar or header of a website which can be used to login > from ANY page. > > The problem is that the login form needs to be somehow ''included'' in the > application ''global'' layout, but all the reference material places the > "login" method as a separate view. > > How would I include the login as part of the layout? > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
On Nov 16, 2007, at 10:24 PM, Steve Oco wrote:> I seem to be having a very hard time creating a login form that would > sit in the sidebar or header of a website which can be used to login > from ANY page. > > The problem is that the login form needs to be somehow ''included'' in > the > application ''global'' layout, but all the reference material places the > "login" method as a separate view. > > How would I include the login as part of the layout?Here''s how I do it: In my views directory I created a directory called shared, where I put any partials that are used in more than one place. In there I have a partial named _quick_login_form.rhtml that creates the form fields. Then in my layout I have this: <div class = "quick-login"> <% form_tag :action => ''login'', :controller => :login do %> <%= render :partial => ''/shared/quick_login_form'' %> <%= submit_tag "Member Login" %><br> <span id="very-small-link"><%= link_to "Forgot your Login?", :action => :forgotten_login, :controller => :login %></span> <% end %> </div> You could put the whole form in the partial, of course. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---