Skip to content
Browse files

Add layout html on home page, added Bootstrap and custom css

  • Loading branch information...
1 parent 276ab20 commit ad59edcab2a093e85bdbb056071786624975b489 @safalmj committed Aug 23, 2012
View
2 Gemfile
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
gem 'rails', '3.2.6'
-
+gem 'bootstrap-sass', '2.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
View
2 Gemfile.lock
@@ -30,6 +30,7 @@ GEM
multi_json (~> 1.0)
addressable (2.2.8)
arel (3.0.2)
+ bootstrap-sass (2.0.0)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
@@ -159,6 +160,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ bootstrap-sass (= 2.0.0)
capybara (= 1.1.2)
coffee-rails (~> 3.2.1)
guard-rspec (= 0.5.5)
View
104 app/assets/stylesheets/custom.css.scss
@@ -0,0 +1,104 @@
+@import "bootstrap";
+
+/* universal */
+
+html {
+ overflow-y: scroll;
+}
+
+body {
+ padding-top: 60px;
+}
+
+section {
+ overflow: auto;
+}
+
+textarea {
+ resize: vertical;
+}
+
+.center {
+ text-align: center;
+}
+
+.center h1 {
+ margin-bottom: 10px;
+}
+
+/* typography */
+
+h1, h2, h3, h4, h5, h6 {
+ line-height: 1;
+}
+
+h1 {
+ font-size: 3em;
+ letter-spacing: -2px;
+ margin-bottom: 30px;
+ text-align: center;
+}
+
+h2 {
+ font-size: 1.7em;
+ letter-spacing: -1px;
+ margin-bottom: 30px;
+ text-align: center;
+ font-weight: normal;
+ color: #999;
+}
+
+p {
+ font-size: 1.1em;
+ line-height: 1.7em;
+}
+
+/* header */
+
+#logo {
+ float: left;
+ margin-right: 10px;
+ font-size: 1.7em;
+ color: #fff;
+ text-transform: uppercase;
+ letter-spacing: -1px;
+ padding-top: 9px;
+ font-weight: bold;
+ line-height: 1;
+}
+
+#logo:hover {
+ color: #fff;
+ text-decoration: none;
+}
+
+/* footer */
+
+footer {
+ margin-top: 45px;
+ padding-top: 5px;
+ border-top: 1px solid #eaeaea;
+ color: #999;
+}
+
+footer a {
+ color: #555;
+}
+
+footer a:hover {
+ color: #222;
+}
+
+footer small {
+ float: left;
+}
+
+footer ul {
+ float: right;
+ list-style: none;
+}
+
+footer ul li {
+ float: left;
+ margin-left: 10px;
+}
View
13 app/views/layouts/_footer.html.erb
@@ -0,0 +1,13 @@
+<footer class="footer">
+ <small>
+ <a href="http://railstutorial.org/">Rails Tutorial</a>
+ by Michael Hartl
+ </small>
+ <nav>
+ <ul>
+ <li><%= link_to "About", '#' %></li>
+ <li><%= link_to "Contact", '#' %></li>
+ <li><a href="http://news.railstutorial.org/">News</a></li>
+ </ul>
+ </nav>
+</footer>
View
14 app/views/layouts/_header.html.erb
@@ -0,0 +1,14 @@
+<header class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <%= link_to "sample app", '#', :id => "logo" %>
+ <nav>
+ <ul class="nav pull-right">
+ <li><%= link_to "Home", '#' %></li>
+ <li><%= link_to "Help", '#' %></li>
+ <li><%= link_to "Sign in", '#' %></li>
+ </ul>
+ </nav>
+ </div>
+ </div>
+</header>
View
3 app/views/layouts/_shim.html.erb
@@ -0,0 +1,3 @@
+<!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
View
9 app/views/layouts/application.html.erb
@@ -5,10 +5,15 @@
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
+ <%= render 'layouts/shim' %>
</head>
<body>
-
-<%= yield %>
+
+ <%= render 'layouts/header' %>
+ <div class="container">
+ <%= yield %>
+ <%= render 'layouts/footer' %>
+ </div>
</body>
</html>
View
13 app/views/static_pages/home.html.erb
@@ -3,3 +3,16 @@
<p>
This is the home page for the<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application.
</p>
+
+<div class ="center hero-unit">
+ <h1>Welcome to the Sample App</h1>
+
+ <h2>
+ This is the home page for the
+ <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
+ sample application.
+ </h2>
+ <%= link_to "Sign up now!", "#", :class => "btn btn-large btn-primary" %>
+</div>
+
+<%= link_to image_tag("rails.png", :alt => "Rails"), 'http://rubyonrails.org/' %>
View
1 config/routes.rb
@@ -1,4 +1,5 @@
SampleApp::Application.routes.draw do
+ root :to => "staticPages#home"
get "static_pages/home"
get "static_pages/help"
get "/static_pages/about"
View
14 foobar
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>SampleApp</title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>

0 comments on commit ad59edc

Please sign in to comment.
Something went wrong with that request. Please try again.