Skip to content

Instantly share code, notes, and snippets.

@aokolish
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aokolish/341f33dcaa2ef6997af5 to your computer and use it in GitHub Desktop.
Save aokolish/341f33dcaa2ef6997af5 to your computer and use it in GitHub Desktop.
Nested layout in rails
-# This file contains the 'layout' for this section of the site
%section.how-it-works-page.content-section
.container
.row
.col-md-12
%h2.section-title How It Works
.sub-nav.row
.col-sm-3
= active_link_to how_we_find_kids_path, class: 'link-wrap' do
.img.school
%span How we find kids
.col-sm-3
= active_link_to our_laptops_path, class: 'link-wrap' do
.img.laptop
%span Our laptops
.col-sm-3
= active_link_to reporting_to_donors_path, class: 'link-wrap' do
.img.report
%span Reporting to donors
.col-sm-3
= active_link_to why_this_matters_path, class: 'link-wrap' do
.img.heart
%span Why this matters
#how-it-works-content
.container
.row
.col-md-12
= yield
-# the layout used throughout the site
!!!
%html
%head
= yield :experiment
%title
- if Rails.env.development?
(dev)
= @page_title || 'Codestarter.org: Laptops for kids'
= stylesheet_link_tag '//fonts.googleapis.com/css?family=Roboto:400,700,500,900,300,100,300italic|Roboto+Slab:400,300,700,100|Indie+Flower'
= stylesheet_link_tag 'application', :media => 'all'
= csrf_meta_tags
%link(rel="icon" type="image/png" href="/favicon.png")
%link(rel="image_src" type="image/png" href="#{image_url('logo.png')}")
%meta(http-equiv="X-UA-Compatible" content="IE=edge")
%meta(name="viewport" content="width=device-width, initial-scale=1")
%meta(name="title" content="Codestarter.org")
%meta(name="description" content="At Codestarter, we want to ensure that every child has the opportunity to learn how to code. And it all starts with having a computer.")
= render 'application/js_analytics'
%body(class="#{body_class}")
#wrapper
-#= render 'application/admin_status' if admin?
= render 'application/flash'
= render 'shared/header'
.content= yield
= render 'shared/footer'
= javascript_include_tag 'application'
-# using the 'how it works' layout to wrap this pages content
= render layout: 'how_it_works/layout' do
%p our laptops...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment