# Layouts [![Gem Version](https://badge.fury.io/rb/trusty-layouts-extension.svg)](http://badge.fury.io/rb/trusty-layouts-extension) Merges share_layouts and nested_layouts, making the whole layout adventure a lot more enjoyable ## Share Layouts ### Introduction Allows Rails controllers/actions to use Trusty CMS 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. #### Inside a controller Controller SomeController < SiteController trusty_layout 'Layout name' # or trusty_layout { |controller| c.action_name == "index" ? "main" : "alt" } # and def delete @trusty_layout = 'delete' end end trusty_layout takes the same options as the built-in layout. To specifically override the Trusty CMS layout and use a standard Rails one use :layout => "mine", or :layout => false for no layout, as options to render. To choose a different Trusty CMS layout, set the @trusty_layout instance variable to the name of a Trusty CMS layout in your controller or view. ### Acknowledgments * Merged into radiant-layouts-extension, Dirk Kelly, August 2010 * Updated to work with 0.8 RC1 by: Johannes Fahrenkrug (http://springenwerk.com), May 22, 2009 * Created by: Sean Cribbs (seancribbs AT gmail DOT com), September 20, 2007 * 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. ## Nested Layouts ### Introduction Nested Layouts enables reuse of a top-level "master" layout (one that contains your tags and the overall structure/wrapper of your site) for several different "nested" layouts (i.e. a one-column layout and a two-column layout). Keep your layouts DRY! A simple example is of the following wrapper and page layout