Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An extension for Radiant CMS that allows controllers to render their views within Radiant layouts.
Ruby
branch: master

This branch is 14 commits ahead, 69 commits behind radiant:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
lib
spec
README
Rakefile
share_layouts_extension.rb

README

= Share Layouts

Created by: Sean Cribbs (seancribbs AT gmail DOT com), September 20, 2007
Updated to work with 0.8 RC1 by: Johannes Fahrenkrug (http://springenwerk.com), May 22, 2009

This version extended by will to handle mailers too and to provide a `layout_for` method.

Allows Rails controllers/actions and mailers to use Radiant layouts as their "layout".  
content_for blocks are mapped to page parts, with the exception of :title and
:breadcrumbs, which map to their specific default tags. The default content, or 
@content_for_layout, is mapped to the 'body' part.

== What to do in your controllers 

  radiant_layout 'Layout name'

-or-

  radiant_layout { |controller| # some code to determine layout name }

-or-

	radiant_layout { |controller| layout_for :calendar }
	
which will use the layout name specified in the `calendar.layout` config item then default to 'Main' or the first layout it can find.

== What to do in your mailers

  radiant_layout		# defaults to config['email.layout'] and then to 'email'

-or-

  radiant_layout 'Layout name'

-or-

  radiant_layout { |mailer| # some code to determine layout name }

radiant_layout takes the same options as the built-in layout.  To specifically
override the Radiant layout and use a standard Rails one use 
:layout => "mine", or :layout => false for no layout, as options to render.

To choose a different Radiant layout, set the @radiant_layout instance 
variable to the name of a Radiant layout in your controller or view.

The mailers 

== Acknowledgments

Thanks to John Long for clarifying and simplifying the process for me!
Thanks to xtoddx for improving the tests and support for tags that use the 
request and response.
Thanks to Digital Pulp, Inc. for funding the initial development of this
extension as part of the Redken.com project.
Something went wrong with that request. Please try again.