Right--you typically bring a stylesheet file into your app w/goo like this in 
the layout:

<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title>My Cool App: <%= controller.action_name %></title>
  <%= stylesheet_link_tag 'my_stylesheet' %>
</head>

You can bring as many stylesheets as you want into your layout.  So e.g., this 
will work:

  <%= stylesheet_link_tag 'my_stylesheet' %>
  <%= stylesheet_link_tag 'large_fonts'   if cookies[:large_fonts] %>
  <%= stylesheet_link_tag 'high_contrast' if cookies[:high_contrast] %>

Or maybe better:

  <%= stylesheet_link_tag cookies[:font_size] if cookies[:font_size] %>

To let you name the stylesheet file in the cookie, so you can do 
small/medium/large, say.

Just give the user links to actions that set/unset those cookies & you should 
be good to go.

HTH,

-Roy

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Hassan Schroeder
Sent: Wednesday, July 15, 2009 9:47 AM
To: [email protected]
Subject: [Rails] Re: How to dynamically change stylesheets globally?


On Wed, Jul 15, 2009 at 9:42 AM, Patrick Doyle<[email protected]> wrote:

> Thanks... I wasn't aware of self.get_layout.  But my issue isn't so
> much selecting a layout as it is passing the parameters around to help
> me decide which layout (or which stylesheet) I should use.

> Or, there could be a much more obvious way to tackle this problem.

Why not just save the user preference in a persistent cookie, so it continues 
in effect when the user returns?

--
Hassan Schroeder ------------------------ [email protected]
twitter: @hassan



GHC Confidentiality Statement

This message and any attached files might contain confidential information 
protected by federal and state law. The information is intended only for the 
use of the individual(s) or entities originally named as addressees. The 
improper disclosure of such information may be subject to civil or criminal 
penalties. If this message reached you in error, please contact the sender and 
destroy this message. Disclosing, copying, forwarding, or distributing the 
information by unauthorized individuals or entities is strictly prohibited by 
law.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to