Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/westonganger/rails_nestable_layouts

Rails Nestable Layouts - Dead simple nested layouts for Rails
https://github.com/westonganger/rails_nestable_layouts

layout layouts nestable nestable-layouts nested-layouts rails rails-nested-layouts

Last synced: 2 months ago
JSON representation

Rails Nestable Layouts - Dead simple nested layouts for Rails

Awesome Lists containing this project

README

        

# Rails Nestable Layouts
Gem Version
CI Status
RubyGems Downloads
Buy Me a Coffee

Dead simple nested layouts support for Rails. Does not monkey patch anything. Can nest as many layouts as desired.

## Install

```ruby
gem 'rails_nestable_layouts'
```

## Usage

### Your Controller
```ruby
# main layout, this line is not necessary. Note nested_layouts does not override the main layout.
layout :application

# accepts the same options as before_action/before_filter
nested_layouts 'layouts/secondary_layout', 'posts/layout', except: [:index]
```

### Main Layout
```erb



My Main Layout




<%= yield_nested %>

```

### Nested Layout(s)
```erb

My Nested Layout

<%= yield_nested %> # this will call the next nested layout or the requested template if no more nested layouts.
```


# Credits

Created by Weston Ganger - @westonganger

Buy Me a Coffee