- Get link
- X
- Other Apps
Foundation - front-end for quickly building applications in Ruby on Rails
It is similar to Twitter Bootstrap but uses Sass instead of LESS. Here you will learn the basics of the grid system, navigation, tooltips and more.
Resources
terminal
rails new store rails g scaffold product name price:decimal --skip-stylesheets rake db:migrate rails g foundation:install
Gemfile
gem 'zurb-foundation'
layouts/application.html.erb
<nav class="top-bar"> <ul class="title-area"> <li class="name"> <h1><%= link_to "Awesome Store", products_path %></a></h1> </li> </ul> <section class="top-bar-section"> <ul class="right"> <li class="divider"></li> <li><%= link_to "Browse Products", products_path %></li> <li class="divider"></li> <li><%= link_to "Price List" %></li> <li class="divider"></li> <li><%= link_to "Contact Us" %></li> <li class="divider"></li> <li><%= link_to "Cart" %></li> </ul> </section> </nav> <div class="row"> <div class="small-8 columns"><%= yield %></div> <div class="small-4 columns"> <h2 class="subheader">About Us</h2> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> </div>
products/index.html.erb
<%= link_to 'New Product', new_product_path, class: "button radius" %>
products/_form.html.erb
<div class="row collapse"> <div class="small-3 columns"> <%= f.label :name, class: "right inline" %> </div> <div class="small-9 columns"><%= f.text_field :name %></div> </div> <div class="row collapse"> <div class="small-3 columns"> <%= f.label :price, class: "right inline", title: "Price in USD", data: {tooltip: true} %> </div> <div class="small-9 columns"><%= f.text_field :price %></div> </div> <div class="row collapse"> <div class="small-9 small-offset-3 columns"><%= f.submit %></div> </div>
assets/stylesheets/layout.css.scss
label.right { padding-right: 10px; }
assets/stylesheets/foundation_and_overrides.scss
$column-gutter: emCalc(60px); $topbar-bg: #212D48 !default;
Foundation is the most advanced responsive front-end framework in the world. Quickly go from prototype to production, building sites or apps that work on any kind of device with Foundation. Includes a fully customizable, responsive grid, a large library of Sass mixins, commonly used JavaScript plugins, and full accessibility support.
Getting Started
The quickest way to get started is with the basic CSS download. You can get versions with every component, essential ones only, or a custom build.
If you're a Sass user, we have two starter project templates, the Basic Template and the ZURB Template. You can install them by manually downloading them from GitHub, or using the Foundation CLI.
Lastly, if you're rolling your own setup, you can install Foundation through a variety of package managers.