I have few problems with nested layouts. On my site, I need to make one separate part of the site for the administrator only.
I have this in my file application.html.erb:
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
I was wondering how I can now add another template like this inside <%= yield %>, because that part of the administrator's me again need a fixed part of the site, such as header, and footerin the main layout. Instead, headerand footerI will have two menus. I want it to <%= yield %>be filled with a new template, which will have a menu at the top and a new <%= yield %>one that will be filled with actions from the administrator controller. That way, the menu will always stay on top.
I made a partial menu views/admins/_menu.html.erb:
<div>
<div>
<div class="container">
<ul>
<li><%= link_to "Action1", '#' %></li>
<li><%= link_to "Action2", '#' %></li>
<li><%= link_to "Action3", '#' %></li>
</ul>
</div>
</div>
</div>
layouts/sublayouts/admin.html.erb:
<%= render 'admins/menu' %>
<%= yield %>
views/admins/_menu.html.erb , .
:
Header/Menu
|
Container
|Content
Footer
- :
Header/Menu
|
Container
|Content
|Admin Menu
|Admin Content
|
Footer
?