public
Description: A resourceful plugin providing lightweight content management functionality to Rails applications
Home | Edit | New

How to use sandstone with a default template

I may be missing a feature that already exists, but:

In a helper, do something like:


def default(options={}, &block) options.merge!(:body => capture(&block)) concat(render(:partial => '/layouts/default', :locals => options), block.binding) end

Then in the template, just do:


<% default do%> ... <% your code %> ... <% end %>

Then, finally, in the layout (‘/layouts/default’ in this case):

<html > <% the sandstone header stuff %> <body> <%= body %>

Of course the above html would have all of your divs and header/meta stuff.

That way you don’t have to copy and paste it for every page.

Last edited by mischa, Tue Sep 09 04:26:07 -0700 2008
Home | Edit | New
Versions: