Last active
August 29, 2015 13:57
-
-
Save lisasy/9772466 to your computer and use it in GitHub Desktop.
Nested application layouts for Rails projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! | |
%html | |
%head | |
%meta{:charset => "utf-8"} | |
%meta{:content => "NOODP", :name => "ROBOTS"} | |
%meta{name: 'viewport', content: 'width=device-width; initial-scale=1.0; maximum-scale=1.0;'} | |
%title= page_title | |
= stylesheet_link_tag :application, :media => 'all' | |
= csrf_meta_tags | |
%body{:class => body_class} | |
- if content_for?(:banner) | |
= yield :banner | |
%section.container | |
= render 'flashes' | |
= yield | |
= render 'shared/footer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= content_for :banner do | |
= render 'shared/banner' | |
= render template: 'application' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PagesController < ApplicationController | |
include HighVoltage::StaticPage | |
before_filter :check_for_current_user | |
layout :landing_layout | |
private | |
def landing_layout | |
case params[:id] | |
when 'home' | |
'landing' | |
else | |
'application' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment