Hi, How would one access the current layout name from a view? Thanks, GiantCranes -- 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 -~----------~----~----~----~------~----~------~--~---
Perhaps some background info would help:
I am using a dynamic layout based on a user preference. Each of these 
layouts use a common html header partial which imports some css 
stylesheets. I would like to do something like this in the header 
partial:
<%= stylesheet_link_tag "templates/#{layout}" %>
Is this possible without passing in a layout argument to the partial?
thanks
-- 
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
-~----------~----~----~----~------~----~------~--~---
You can use yield if you know there''s going to be something there.  
For example:
<%= stylesheet_link_tag "templates/#{yield :section_css}" %>
Then in your view, do this:
<% content_for :section_css do %>my_css_file_name<% end %>
If you really want to push this to the controller, I think you can  
still set @content_for_foo so that:
@content_for_section_css = ''my_css_file_name''
should have the same effect as setting it in the view.
If you forget to set the section_css, though, you''ll have a  
stylesheet link to nowhere :)
On May 19, 2007, at 11:50 PM, Giant Cranes wrote:
>
> Perhaps some background info would help:
>
> I am using a dynamic layout based on a user preference. Each of these
> layouts use a common html header partial which imports some css
> stylesheets. I would like to do something like this in the header
> partial:
>
> <%= stylesheet_link_tag "templates/#{layout}" %>
>
> Is this possible without passing in a layout argument to the partial?
>
> thanks
>
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >
Steve Ross
sross-ju+vs0qJmyeQKKlA4PA9hA@public.gmane.org
http://www.calicowebdev.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
-~----------~----~----~----~------~----~------~--~---
Did you ever figure this out? I''m trying to do the same thing. -- John On Sun, May 20, 2007 at 2:50 AM, Giant Cranes < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Perhaps some background info would help: > > I am using a dynamic layout based on a user preference. Each of these > layouts use a common html header partial which imports some css > stylesheets. I would like to do something like this in the header > partial: > > <%= stylesheet_link_tag "templates/#{layout}" %> > > Is this possible without passing in a layout argument to the partial? > > thanks > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> Identry, LLC Northport, NY 11768 Phone: (631) 754-8440 Fax: (631) 980-4262 Email: jalmberg-bg7kQ49iwAdBDgjK7y7TUQ@public.gmane.org Member: ABA, ANA, ASDA, APS, ESA, The Coalition Against Unsolicited Commercial Email, Long Island Web Developer''s Guild. Visit us on the web at www.identry.com <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> BUILDING YOU A BETTER ONLINE BUSINESS <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---