Re: Rails 3, HowTo - Pass a Setting to the Application.html.erb

namxam
Sat, 09 Oct 2010 09:52:18 -0000

Or you could add something like

<body class="<%= yield(:body_class) %>">
  … your stuff


and set a conditional css class which can handle the padding. Set the
class with content_for()

On Oct 9, 10:32 am, "Robert Pankowecki (rupert)"
<robert.pankowe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> In my opinion you should have 2 layouts.
> * application,
> * padding.
>
> The `padding'' layout should be nested inside application and
> (according to its name) add some padding :-). Look here about how to
> do it in rails 2 and
3:https://rails.lighthouseapp.com/projects/8994/tickets/5305-rails3-rc-...
>
> With that you could setup layout per every action.
>
> layout :application
> layout :padding, :only => [:new].
>
> The second way of doing this:
>
> Add one more stylesheet in every view that needs padding:
>
> #application.html.erb layout
>
>
>   <%= yield :head %>
>
>
> #new.html.erb
> content_for(:head) do
>   stylesheet_link_tag ''padding''
> end
>
> You could abstract it into helper method and use as simple as:
> #new.html.erb
> <%= padding() %>
>
> Third way is to create helper that would be used this way:
>
> <%= padding do %>
>   create your content here
> <% end %>
>
> I wouldn''t bother controller with such a minor change in view
layer so
> I prefere keeping padding in views instead changing layout on the
> controller side.
>
> Robert Pankowecki

--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.