I''m trying to figure out how multiple partials in one page would be configured when they are based on some action in the controller. As an example - I have a main/welcome page. If someone new or a user not logged in arrives at this page I display both a registration form and a login form. However, if they are logged in then those forms should not show up on that page. Also should mention that I have a _register partial and a _login partial. Now maybe I just need a seperate page to welcome users who are logged in but I want to see if I could do it as described above. Right now the welcome.rhtml page is set up like such: <% if @u %> #if user is logged in / session <%= render :partial => "main/logout" %> <%= render :partial => "main/session" %> <%= @c.first_name %> <% else %> <%= render :partial => "main/login" %> <%= render :partial => "main/register" %> <% end %> And in the layout: <div id="Menu"> <%= render(:partial => "logout" )%> <%= render(:partial => "register" ) %> </div> <div id="Menu2"> <%= render(:partial => "login" ) %> </div> So I think this is all wrong but not sure how to go about accomplishing my design. Any help / suggestions would be greatly appreciated. TIA Stuart
So what exactly is your problem? I can''t quite work that out from the post. What are you trying to achieve and why is what you are doing currently not working? Max On 8/10/06, Dark Ambient <sambient@gmail.com> wrote:> I''m trying to figure out how multiple partials in one page would be > configured when they are based on some action in the controller. > As an example - > I have a main/welcome page. If someone new or a user not logged in > arrives at this page I display both a registration form and a login > form. However, if they are logged in then those forms should not show > up on that page. Also should mention that I have a _register partial > and a _login partial. > > Now maybe I just need a seperate page to welcome users who are logged > in but I want to see if I could do it as described above. > Right now the welcome.rhtml page is set up like such: > > <% if @u %> #if user is logged in / session > <%= render :partial => "main/logout" %> > <%= render :partial => "main/session" %> > <%= @c.first_name %> > <% else %> > <%= render :partial => "main/login" %> > <%= render :partial => "main/register" %> > <% end %> > > And in the layout: > <div id="Menu"> > <%= render(:partial => "logout" )%> > <%= render(:partial => "register" ) %> > </div> > <div id="Menu2"> > <%= render(:partial => "login" ) %> > </div> > > So I think this is all wrong but not sure how to go about > accomplishing my design. > Any help / suggestions would be greatly appreciated. > > TIA > Stuart > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Is my question just ridiculous , too basic or no one actually knows ? Stuart On 8/10/06, Andr?s Tarsoly <tarsolya@gmail.com> wrote:> none > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi -- On Thu, 10 Aug 2006, Dark Ambient wrote:> I''m trying to figure out how multiple partials in one page would be > configured when they are based on some action in the controller. > As an example - > I have a main/welcome page. If someone new or a user not logged in > arrives at this page I display both a registration form and a login > form. However, if they are logged in then those forms should not show > up on that page. Also should mention that I have a _register partial > and a _login partial. > > Now maybe I just need a seperate page to welcome users who are logged > in but I want to see if I could do it as described above. > Right now the welcome.rhtml page is set up like such: > > <% if @u %> #if user is logged in / session > <%= render :partial => "main/logout" %> > <%= render :partial => "main/session" %> > <%= @c.first_name %> > <% else %> > <%= render :partial => "main/login" %> > <%= render :partial => "main/register" %> > <% end %> > > And in the layout: > <div id="Menu"> > <%= render(:partial => "logout" )%> > <%= render(:partial => "register" ) %> > </div> > <div id="Menu2"> > <%= render(:partial => "login" ) %> > </div> > > So I think this is all wrong but not sure how to go about > accomplishing my design. > Any help / suggestions would be greatly appreciated.Don''t put things in the layout unless you want them displayed :-) David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack''s][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.
Ok, I realized that was my problem but I still need to use @content_for_layout though Stuart On 8/11/06, dblack@wobblini.net <dblack@wobblini.net> wrote:> Hi -- > > On Thu, 10 Aug 2006, Dark Ambient wrote: > > > I''m trying to figure out how multiple partials in one page would be > > configured when they are based on some action in the controller. > > As an example - > > I have a main/welcome page. If someone new or a user not logged in > > arrives at this page I display both a registration form and a login > > form. However, if they are logged in then those forms should not show > > up on that page. Also should mention that I have a _register partial > > and a _login partial. > > > > Now maybe I just need a seperate page to welcome users who are logged > > in but I want to see if I could do it as described above. > > Right now the welcome.rhtml page is set up like such: > > > > <% if @u %> #if user is logged in / session > > <%= render :partial => "main/logout" %> > > <%= render :partial => "main/session" %> > > <%= @c.first_name %> > > <% else %> > > <%= render :partial => "main/login" %> > > <%= render :partial => "main/register" %> > > <% end %> > > > > And in the layout: > > <div id="Menu"> > > <%= render(:partial => "logout" )%> > > <%= render(:partial => "register" ) %> > > </div> > > <div id="Menu2"> > > <%= render(:partial => "login" ) %> > > </div> > > > > So I think this is all wrong but not sure how to go about > > accomplishing my design. > > Any help / suggestions would be greatly appreciated. > > Don''t put things in the layout unless you want them displayed :-) > > > David > > -- > http://www.rubypowerandlight.com => Ruby/Rails training & consultancy > ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- > http://dablog.rubypal.com => D[avid ]A[. ]B[lack''s][ Web]log > http://www.manning.com/black => book, Ruby for Rails > http://www.rubycentral.org => Ruby Central, Inc. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
In your layout just surround the 2 divs with the if statement just like you did in welcomr.rhtml On 8/11/06, Dark Ambient <sambient@gmail.com> wrote:> > Is my question just ridiculous , too basic or no one actually knows ? > > Stuart > > On 8/10/06, Andr?s Tarsoly <tarsolya@gmail.com> wrote: > > none > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060811/e1460d6a/attachment.html